If, say for example, I draw a quad that is textured with an image that uses blending and is only opaque towards the middle and the edges are completely transparent, does the stencil buffer still flag the pixels “hit” by the whole quad or only the ones that had some degree of opacity? The reason I’m asking is because I’m wanting to render a neat little blended glowing sheild graphic with soft edges and such using a bitmap with alpha values. And I’m using the stencil buffer with this but I only want it to register a “hit” on pixels where the “halo” is actually drawn. Thanks!
It will draw the completely transparent pixels unless you are using an alpha test that prevents it from drawing the transparent parts.
How do you go about doing an alpha test when rendering to the stencil buffer?
First off, alpha testing is completely independent of stenciling. You use alpha testing the same way as you would if you were not using stenciling.
To enable alpha testing, first use glEnable(GL_ALPHA_TEST)
You then need to set which alpha function to use and which reference value to use.
If you only wanted to draw pixels which have an alpha greater than 0, then you’d use glAlphaFunc(GL_GREATER,0)
Be sure to disable the alpha test when you are done drawing all alpha tested polys.
[This message has been edited by DFrey (edited 11-02-2000).]
Thanks a TON! I really appreciate your help!