non-rectangular viewport??

non-rectangular viewport??

Post by Jayd » Fri, 17 Jul 1998 04:00:00



Is a non-rectangular viewport possible? Eg. looking thru a static image
of car windshield or house window.

thanx

JD

 
 
 

non-rectangular viewport??

Post by Thomas Johnso » Fri, 17 Jul 1998 04:00:00


Yes...If You draw the image of the Car window and the inside of the car to
the stencil buffer then enable it nothing will be drawn over it...But I
must warn you that is a resource hog and can really slow down your program.

-Tom j


> Is a non-rectangular viewport possible? Eg. looking thru a static image
> of car windshield or house window.

> thanx

> JD


 
 
 

non-rectangular viewport??

Post by Paul Mart » Sat, 18 Jul 1998 04:00:00



>Is a non-rectangular viewport possible? Eg. looking thru a static image
>of car windshield or house window.

Somebody already mentioned the stencil buffer.

Another option would be to use overlay planes. Unfortunately, all
implementations do not support them. You also might not be able to get them
in the desired pixel depth.

   -Paul Martz
    Hewlett Packard Graphics Products Lab
    To reply, remove "DONTSPAM" from email address.

 
 
 

non-rectangular viewport??

Post by Andy Vespe » Sat, 18 Jul 1998 04:00:00



> Is a non-rectangular viewport possible? Eg. looking thru a static image
> of car windshield or house window.

You can't change the OpenGL 'viewport' to something non-rectangular,
but you can certainly avoid rendering into particular areas.
Let's call the portion to be rendered the 'inside' and the portion
not to be rendered the 'outside'.

You can either use the stencil buffer, or you can use the depth
buffer. Normally an application will clear the buffers at the
start of a frame using glClear. For this purpose, you want to
clear the buffers in two passes.

First, you want to clear the entire window to denote it as 'outside';
either setting the stencil buffer to 0 or the depth buffer to 'near'.
This might be done at the beginning of time, rather than for
each frame.

Second, you want to clear the 'inside' and mark it as such. You
want to render geometric primitives with background color/texture
that cover 'inside', either setting the stencil values to 1 or
setting the depth value to 'far' (use GL_ALWAYS as the depth test).

Finally, you are ready to render the rest of the frame, setting
the stencil test to == 1 or using depth testing 'normally'. You may
want to use glDepthRange to make sure that the frame can't interfere
with the depth values used to mark 'outside'.
--
Andy V, OpenGL Alpha Geek  (never a Digital spokesperson)

(To send mail to me, remove ".NoSpamEver".)