GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


Manpage of GLSTENCILOP

GLSTENCILOP

Index
 

NAME

glStencilOp - set stencil test actions

delim $$  

C SPECIFICATION

void f3glStencilOpfP( GLenum fIfailfP,
f2failfP
Specifies the action to take when the stencil test fails.
Six symbolic constants are accepted:
%f3GL_KEEPfP,
%f3GL_ZEROfP,
%f3GL_REPLACEfP,
%f3GL_INCRfP,
%f3GL_DECRfP, and
%f3GL_INVERTfP. The initial value is %f3GL_KEEPfP. 
f2zfailfP
Specifies the stencil action when the stencil test passes, but the depth test fails. f2zfailfP accepts the same symbolic constants as f2failfP. The initial value is %f3GL_KEEPfP.
f2zpassfP
Specifies the 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. f2zpassfP accepts the same symbolic constants as f2failfP. The initial value is %f3GL_KEEPfP.
 

DESCRIPTION

Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. You draw into the stencil planes using GL drawing primitives, then render geometry and images, using the stencil planes to mask out portions of the screen. Stenciling is typically used in multipass rendering algorithms to achieve special effects, such as decals, outlining, and constructive solid geometry rendering. The stencil test conditionally eliminates a pixel based on the outcome of a comparison between the value in the stencil buffer and a reference value. To enable and disable the test, call %f3glEnablefP and %f3glDisablefP with argument %f3GL_STENCIL_TESTfP; to control it, call %f3glStencilFuncfP. %f3glStencilOpfP takes three arguments that indicate what happens to the stored stencil value while stenciling is enabled. If the stencil test fails, no change is made to the pixel's color or depth buffers, and f2failfP specifies what happens to the stencil buffer contents. The following six actions are possible.
%f3GL_KEEPfP
Keeps the current value.
%f3GL_ZEROfP
Sets the stencil buffer value to 0.
%f3GL_REPLACEfP
Sets the stencil buffer value to f2reffP, as specified by %f3glStencilFuncfP.
%f3GL_INCRfP
Increments the current stencil buffer value. Clamps to the maximum representable unsigned value.
%f3GL_DECRfP
Decrements the current stencil buffer value. Clamps to 0.
%f3GL_INVERTfP
Bitwise inverts the current stencil buffer value. Stencil buffer values are treated as unsigned integers. When incremented and decremented, values are clamped to 0 and $2 sup n - 1$, where $n$ is the value returned by querying %f3GL_STENCIL_BITSfP. The other two arguments to %f3glStencilOpfP specify stencil buffer actions that depend on whether subsequent depth buffer tests succeed (f2zpassfP) or fail (f2zfailfP) (see
%f3glDepthFuncfP). The actions are specified using the same six symbolic constants as f2failfP. Note that f2zfailfP is ignored when there is no depth buffer, or when the depth buffer is not enabled. In these cases, f2failfP and f2zpassfP specify stencil action when the stencil test fails and passes, respectively.
 

NOTES

Initially the stencil test is disabled. If there is no stencil buffer, no stencil modification can occur and it is as if the stencil tests always pass, regardless of any call to %f3glStencilOpfP.  

ERRORS

%f3GL_INVALID_ENUMfP is generated if f2failfP, f2zfailfP, or f2zpassfP is any value other than the six defined constant values. %f3GL_INVALID_OPERATIONfP is generated if %f3glStencilOpfP is executed between the execution of %f3glBeginfP and the corresponding execution of %f3glEndfP.  

ASSOCIATED GETS

%f3glGetfP with argument %f3GL_STENCIL_FAILfP
%f3glGetfP with argument %f3GL_STENCIL_PASS_DEPTH_PASSfP
%f3glGetfP with argument %f3GL_STENCIL_PASS_DEPTH_FAILfP
%f3glGetfP with argument %f3GL_STENCIL_BITSfP
%f3glIsEnabledfP with argument %f3GL_STENCIL_TESTfP  

SEE ALSO

%f3glAlphaFunc(3G)fP, %f3glBlendFunc(3G)fP, %f3glDepthFunc(3G)fP, %f3glEnable(3G)fP, %f3glLogicOp(3G)fP, %f3glStencilFunc(3G)fP


 

Index

NAME
C SPECIFICATION
DESCRIPTION
NOTES
ERRORS
ASSOCIATED GETS
SEE ALSO