Sign in to follow this  
TravisGesslein

Stencil Buffer confusion

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this