Jump to content
  • Advertisement
Sign in to follow this  

Stencil

This topic is 3748 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
Advertisement
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
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!