i’m trying to implement a non rectangular viewport in a scene (to make a radar ppi). that’s how i’m doing it right now:
- enable stencil
- draw the masking geometry, putting 1 in the stencil buffer where i draw
- draw the scene where stencil bit =1
it works fine as long as i use opengl triangles as region, but if i want to use instead a textured quad with an alpha texture it doesn’t work anymore. Is there a wayaround, maybe using the depth buffer, or should i stick to non textured geometry to define my region?
i can post some pseudo code if you like
[This message has been edited by uruloki (edited 09-19-2003).]
You could just draw your textured quad with alpha on top of your scene after you draw it, and not use the stencil buffer.
The stencil buffer doesnt care if the pixel you are drawing is completely invisible due to alpha, the pixel still gets drawn into the stencil buffer.
that wouldn’t work, because i wanted to use the textured quad as a region to define the shape of my ppi viewport. I guess I’ll use some triangles instead, it will be coarse but i guess it’s the only way (depth didn’t work neither).
thanks for your support
if you enable alpha test (not just blending) it should work fine to set the stencil from an alpha quad.
I know i was missing something pretty obvious
it works very well now, thank you very much.