Graphics Reference
In-Depth Information
transformation happens before the fragment shader stage, while the
scissor test happens after the fragment shader stage.
Stencil Buffer Testing
The next operation that might be applied to a fragment is the stencil test.
The stencil buffer is a per-pixel mask that holds values that can be used to
determine whether a pixel should be updated. The stencil test is enabled
or disabled by the application.
Using the stencil buffer can be considered a two-step operation. The first
step is to initialize the stencil buffer with the per-pixel masks, which is
done by rendering geometry and specifying how the stencil buffer should
be updated. The second step is generally to use those values to control
subsequent rendering into the color buffer. In both cases, you specify how
the parameters are to be used in the stencil test.
The stencil test is essentially a bit test, as you might do in a C program
where you use a mask to determine if a bit is set, for example. The
stencil function, which controls the operator and values of the stencil
test, is controlled by the glStencilFunc or glStencilFuncSeparate
functions.
void glStencilFunc (GLenum func , GLint ref , GLuint mask )
void glStencilFuncSeparate (GLenum face , GLenum func ,
GLint ref , GLuint mask )
specifies the face associated with the provided stencil function.
Valid values are GL_FRONT , GL_BACK , and GL_FRONT_AND_BACK
( glStencilFuncSeparate only).
face
specifies the comparison function for the stencil test. Valid values
are GL_EQUAL , GL_NOTEQUAL , GL_LESS , GL_GREATER ,
GL_LEQUAL , GL_GEQUAL , GL_ALWAYS , and GL_NEVER .
func
specifies the comparison value for the stencil test.
ref
specifies the mask that is bit-wise anded with the bits in the
stencil buffer before being compared with the reference value.
mask
To allow finer control of the stencil test, a masking parameter is used to
select which bits of the stencil values should be considered for the test.
After selecting those bits, their value is compared with a reference value
 
 
 
Search WWH ::




Custom Search