Re: setting zbuffer for rendering window/buffer [message #32389] |
Fri, 04 October 2002 08:50 |
Sebastian Loebbert
Messages: 12 Registered: September 2002
|
Junior Member |
|
|
On Thu, 3 Oct 2002, Karl Schultz wrote:
Hi,
thanks, that does the trick.
Sebastian
>
> The only trick I can think of is to draw a surface that covers your window.
> Each point on the surface is a Z value that you read out of the other
> ...
> Karl
>
>
>
>
|
|
|
Re: setting zbuffer for rendering window/buffer [message #32409 is a reply to message #32389] |
Thu, 03 October 2002 08:34  |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
"Sebastian Loebbert" <sebaaihb@peach.zrz.TU-Berlin.DE> wrote in message
news:Pine.LNX.4.44.0210031359040.18755-100000@peach.zrz.TU-B erlin.DE...
> Hi all,
>
> I would like to set the z-buffer of an IDLgrWindow before rendering to an
> array of z-buffer values I got from another IDLgrWindow using
> win->GetProperty,ZBUFFER_DATA=my_z_buf
> Unfortunately, the is no win->SetProperty, ZBUFFER_DATA=my_z_buf.
> Is there any trick to do this?
The only trick I can think of is to draw a surface that covers your window.
Each point on the surface is a Z value that you read out of the other
window. You could either draw it solidly with your preferred background
color, or use a transparent texture map to set the Z buffer without setting
any pixels in the color buffer.
So, if my_z_buf is a FLOAT(300,300):
- I assume your target window is the same size.
- Set your viewplane_rect to [0,0,300,300]
- Make an IDLgrSurface with my_z_buf as your Z data
- Make an IDLgrImage with a BYTARR(4,2,2) where all values are zero - this
is a transparent texture map - set the TEXTURE_MAP property on the
grSurface.
- The surface would be the first thing to draw
- You may have to fiddle with the Z values a bit to make them work with your
ZCLIP view values, but this is very doable,
- If you don't want your viewplane_rect set to [0,0,300,300], you can use
whatever setting you want, but you would have to use [XY]COORD_CONV to try
to get your surface to draw one surface value per window pixel. I just used
[0,0,300,300] to make the initial explanation of this idea easier.
- If you don't go with a transparent texture map, the solid surface may vary
in color because of lighting. You may want to turn off lights while you
draw this surface if you want it to be a solid background.
I may be leaving out something, but this is at least a start.
Karl
|
|
|