Jump to content
  • Advertisement
Sign in to follow this  

Stencil Buffer confusion

This topic is 2591 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. I will use the stencil buffer to draw 2D shadows, but I'm having some problems figuring out how to render things to the stencil buffer in the correct order, and how to set up the glStencilFuncs and Ops.

What I want to achieve: I have several circle-shaped light sources, geometry somewhere on the screen, and then additional geometry which are simply the shadows that I calculate (in general they work fine, but sometimes they overlap with the geometry that they get cast from which shouldn't be an issue though since I don't draw them directly and just stencil them anyways).

I'm having immense trouble figuring out how, and it what order, I need to draw things into the stencil buffer. Has one of you implemented something like this already and can give me a general rundown on how to render the scene into the stencil buffer properly?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!