Sign in to follow this  

Stencil

This topic is 3587 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

I am aware of stencil but sometimes i think i am using stencil techniques mechanically. glStencilFunc(GL_EQUAL, 1, 0xFFFFFFFF) // Clear to me. glStencilOp(GL_KEEP, GL_KEEP, GL_INCR) I dont really understand what exactly happening with this three constants of glStencilOp(GL_KEEP, GL_KEEP, GL_INCR) function. What i use to understand is this will increament stencil value from 1 to 2. I never care about the first two constants. when should i use and how should use first two parameters. Basically i really don't understand the uses of all three parameters of function glStencilOp(GL_KEEP, GL_KEEP, GL_INCR) Please help me with sample code and with maths

Share this post


Link to post
Share on other sites
You need to understand both glStencilFunc and glStencilOp

These are the explanation for the glStencilOp parameters.

1. The action to take when the stencil test fails.
2. Stencil action when the stencil test passes, but the depth test fails
3. Stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled.

So in your case, you want to increment by 1 when depth test passes and when the stencil buffer contains a 1.

I read the documentation in these cases which is found at www.opengl.org

Share this post


Link to post
Share on other sites

This topic is 3587 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.

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