• Advertisement

Archived

This topic is now archived and is closed to further replies.

Clearing one stencil bit?

This topic is 5508 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Is there some way to clear just one stencil buffer bit? I want to do some clipping with the stencilbuffer and stencil shadow volumes at the same time. I was thinking about using one bit for the clipping, and the rest for shadows. The problem is that the clipper changes when the shadows aren''t, so I want to be able to clear the bit used for the clipper, but leaving the other bits. Is this possible somehow? I guess a fullscreen quad writing that stencil bit would do the trick, but I don''t want to waste more fillrate than I''m already doing. Appreciate tips and ideas.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
You can use glStencilMask() to protect certain bits in the stencilbuffer from being overwritten. glStencilOp() also has a mask parameter that is AND´ed with the value read out of the stencilbuffer before applying the stencil function on it.

skynet

Share this post


Link to post
Share on other sites
Ah, thanks a lot. I think glStencilMask is what I was looking for (if it also masks glClear). I''ll look into it. Thanks.

Share this post


Link to post
Share on other sites
If it doesnt mask for glClear, you could always draw a quad over the screen, width colour & depth writes disabled

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack

Share this post


Link to post
Share on other sites

  • Advertisement