-> Click here to learn how to get live help <-
NAMEglStencilFunc - set function and reference value for stencil testing
C SPECIFICATIONvoid f3glStencilFuncfP( GLenum fIfuncfP,
f2funcfP Specifies the test function. Eight tokens are valid: %f3GL_NEVERfP, %f3GL_LESSfP, %f3GL_LEQUALfP, %f3GL_GREATERfP, %f3GL_GEQUALfP, %f3GL_EQUALfP, %f3GL_NOTEQUALfP, and %f3GL_ALWAYSfP. The initial value is %f3GL_ALWAYSfP.
DESCRIPTIONStenciling, 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 reference value and the value in the stencil buffer. To enable and disable the test, call %f3glEnablefP and %f3glDisablefP with argument %f3GL_STENCIL_TESTfP. To specify actions based on the outcome of the stencil test, call %f3glStencilOpfP. f2funcfP is a symbolic constant that determines the stencil comparison function. It accepts one of eight values, shown in the following list. f2reffP is an integer reference value that is used in the stencil comparison. It is clamped to the range [0,$2 sup n - 1$], where $n$ is the number of bitplanes in the stencil buffer. f2maskfP is bitwise ANDed with both the reference value and the stored stencil value, with the ANDed values participating in the comparison. If f2stencilfP represents the value stored in the corresponding stencil buffer location, the following list shows the effect of each comparison function that can be specified by f2funcfP. Only if the comparison succeeds is the pixel passed through to the next stage in the rasterization process (see %f3glStencilOpfP). All tests treat f2stencilfP values as unsigned integers in the range [0,$2 sup n - 1$], where $n$ is the number of bitplanes in the stencil buffer. The following values are accepted by f2funcfP:
NOTESInitially, the stencil test is disabled. If there is no stencil buffer, no stencil modification can occur and it is as if the stencil test always passes.
ERRORS%f3GL_INVALID_ENUMfP is generated if f2funcfP is not one of the eight accepted values. %f3GL_INVALID_OPERATIONfP is generated if %f3glStencilFuncfP is executed between the execution of %f3glBeginfP and the corresponding execution of %f3glEndfP.
ASSOCIATED GETS%f3glGetfP with argument %f3GL_STENCIL_FUNCfP
%f3glGetfP with argument %f3GL_STENCIL_VALUE_MASKfP
%f3glGetfP with argument %f3GL_STENCIL_REFfP
%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, %f3glIsEnabled(3G)fP, %f3glLogicOp(3G)fP, %f3glStencilOp(3G)fP