View Full Version : What is stencil buffer?
11-28-2001, 06:59 AM
What is actually stencil buffer?
Why use it and for what??
Can someone show me example???
11-28-2001, 09:34 AM
The stencil test is a per pixel operation. When enabled it checks every pixel you draw using a specified stencil test. The stencil buffer used in the calculation of the stencil test. There are three things you need to know first
simple enough, this enables (or you can disable) stencil testing
the second is glStencilFunc(...) it takes three parameters. The first is a constant defined in gl.h that decides which operator is used as a stencil test, for example GL_EQUAL. The next parameter is the reference value, and the final parameter is the mask. When the stencil test is performed the program checks to see whether the value in the stencil buffer AND the mask value = (or whatever function you specify) the reference value AND the mask value. AND is the standerd boolean and. If the stencil test passes, the pixel is drawn, if not it is not.
finally you need glStencilOp(...)
this also has three parameters
all three are constants in gl.h
the first is what to do when the stencil test fails, so if you use GL_KEEP it will keep the current stencil value in the buffer when the stencil test fails
the second parameter is the same thing except for when the depth test fails but the stencil test passes, the last is when both pass.
I hope that makes sense, I am fairly sure its correct
11-29-2001, 04:28 PM
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.