comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: strange behaviour with z-buffer
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: strange behaviour with z-buffer [message #11938] Tue, 09 June 1998 00:00
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
> You must configure the Z-graphics buffer to be exactly like
> your window. This means you need to make the resolution
> and number of colors the same. (The Z-buffer has 256 colors
> by default, which can be a very nice feature when making
> GIF files. In fact, is one reason why I almost always use
> the Z-buffer to make GIF files.) To make the Z-buffer
> exactly like your current graphics window, try this:
>
> ncolors = !D.N_Colors - 1
> Set_Plot, 'Z'
> Device, Set_Resolution=[!D.X_Size, !D.Y_Size], $
> Set_Colors=ncolors

Different devices can also have different default font sizes, so one needs to
be careful of this.

____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars.uchicago.edu (e-mail)

or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
Re: strange behaviour with z-buffer [message #11939 is a reply to message #11938] Mon, 08 June 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Mark Rivers (rivers@cars3.uchicago.edu) adds good advice
to this thread when he writes:

> Different devices can also have different default font
> sizes, so one needs to be careful of this.

The reality is even more sinister than this. I haven't
checked this out in IDL 5.1, but in earlier versions
I have had great difficulty getting 3D axes aligned
properly as I go back and forth in the Z-buffer.

I notice this particularly when I am trying to add axes
to something I need to render in the Z-buffer. (I don't
like to add axes in the Z-buffer because the resolution
in PostScript will be screen resolution and not PostScript
resolution.)

I have solved this problem (I don't know why, exactly)
by making sure I set !P.Charsize = 1 before I enter the
Z-buffer. This seems to make sure that the default
plot margins are set the same way as they are outside
the Z-buffer.

Just one of those weird things you spend about 3 days
learning on your own. Since I screwed up so badly
offering advice today, I thought I would share
something that I normally only offer to the people
who come to my IDL programming classes. :-)

Cheers,

David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: strange behaviour with z-buffer [message #11949 is a reply to message #11939] Mon, 08 June 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Damiano Zilio (damiano.zilio@jrc.it) writes:

> am I creazy or... the plots produced on the momitor by this stupid program
> are different????
> Why????

The problem here is when I say "go left" I mean "go right",
sometimes. :-)

To make the Z-buffer exactly like the window, you have to
set the resolution and colors *outside* the Z device. Otherwise,
you just set the resolution and colors to the defaults of
the Z device! You need something like this:

ncolors = !D.N_Colors - 1
xsize = !D.X_Size
ysize = !D.Y_Size

Set_Plot, 'Z'
Device, Set_Resolution=[xsize, ysize], Set_Colors=ncolors
Help, /Device

Cheers,

David



-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: strange behaviour with z-buffer [message #11950 is a reply to message #11939] Mon, 08 June 1998 00:00 Go to previous message
DAMIANO ZILIO is currently offline  DAMIANO ZILIO
Messages: 8
Registered: February 1997
Junior Member
Dear ALL

David Fanning wrote:

> Damiano Zilio (damiano.zilio@jrc.it) writes:
>
>> I produce gif files with these 2 different ways:
>>
>> 1)
>> set_plot,'x'
>> window,0,reatin=2,xsixe=700,ysize=500
>> plot.....
>> img=tv()
>> write_gif,'filename',img
>>
>> 2)
>> set_plot,'z'
>> device,set_resolution=[700,500]
>> plot
>> img=tv()
>> write_gif,'filename',img
>>
>> But the gif files obtained are different!!!
>> The relative position of the colorbar, using the z-buffer are wrong!,
>> there are some
>> strange overplottings!!
>> Can I avoid this problem?
>
> You must configure the Z-graphics buffer to be exactly like
> your window. This means you need to make the resolution
> and number of colors the same. (The Z-buffer has 256 colors
> by default, which can be a very nice feature when making
> GIF files. In fact, is one reason why I almost always use
> the Z-buffer to make GIF files.) To make the Z-buffer
> exactly like your current graphics window, try this:
>
> ncolors = !D.N_Colors - 1
> Set_Plot, 'Z'
> Device, Set_Resolution=[!D.X_Size, !D.Y_Size], $
> Set_Colors=ncolors
>
> Cheers,
>
> David

am I creazy or... the plots produced on the momitor by this stupid program
are different????
Why????
>>>> >>>>>>>>>>>
pro test1
loadct,16
set_plot,'x'
plot,findgen(5),/nodata,position=[0,0,1,1]
img=tvrd()
write_gif,'x.gif',img
set_plot,'z'
ncolors=!D.N_Colors-1
device,set_Resolution=[!D.X_Size,!D.Y_Size],set_colors=ncolo rs
plot,findgen(5),/nodata,position=[0,0,1,1]
img=tvrd()
write_gif,'z.gif',img
device,/close
set_plot,'x'
read_gif,'x.gif',imgx
read_gif,'z.gif',imgz
window,1,retain=2,title='xgif'
tv,imgx
window,2,retain=2,title='zgif'
tv,imgz
end
>>>> >>>>>>>>>>>>>.

On my monitor the position af the axis in the tv of the image
plotted in the z-buffer is different from the same axes plotter in the x
device
WHY?
WHY?
WHY?

--

Damiano Zilio

Joint Research Centre of the Commission of
the European Communities
I-21020 Ispra (VA)
Re: strange behaviour with z-buffer [message #11951 is a reply to message #11939] Mon, 08 June 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Damiano Zilio (damiano.zilio@jrc.it) writes:

> I produce gif files with these 2 different ways:
>
> 1)
> set_plot,'x'
> window,0,reatin=2,xsixe=700,ysize=500
> plot.....
> img=tv()
> write_gif,'filename',img
>
> 2)
> set_plot,'z'
> device,set_resolution=[700,500]
> plot
> img=tv()
> write_gif,'filename',img
>
> But the gif files obtained are different!!!
> The relative position of the colorbar, using the z-buffer are wrong!,
> there are some
> strange overplottings!!
> Can I avoid this problem?

You must configure the Z-graphics buffer to be exactly like
your window. This means you need to make the resolution
and number of colors the same. (The Z-buffer has 256 colors
by default, which can be a very nice feature when making
GIF files. In fact, is one reason why I almost always use
the Z-buffer to make GIF files.) To make the Z-buffer
exactly like your current graphics window, try this:

ncolors = !D.N_Colors - 1
Set_Plot, 'Z'
Device, Set_Resolution=[!D.X_Size, !D.Y_Size], $
Set_Colors=ncolors

Cheers,

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL and COM
Next Topic: Upgrade from 3.6

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 13:37:08 PDT 2025

Total time taken to generate the page: 0.40460 seconds