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 GLSTENCILFUNC

GLSTENCILFUNC

Index
 

NAME

glStencilFunc - set function and reference value for stencil testing

delim $$  

C SPECIFICATION

void 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. 
f2reffP
Specifies the reference value for the stencil test. f2reffP is clamped to the range [0,$2 sup n - 1$], where $n$ is the number of bitplanes in the stencil buffer. The initial value is 0.
f2maskfP
Specifies a mask that is ANDed with both the reference value and the stored stencil value when the test is done. The initial value is all 1's.
 

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 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:
%f3GL_NEVERfP
Always fails.
%f3GL_LESSfP
Passes if ( f2reffP & f2maskfP ) < ( f2stencilfP & f2maskfP ).
%f3GL_LEQUALfP
Passes if ( f2reffP & f2maskfP ) (<= ( f2stencilfP & f2maskfP ).
%f3GL_GREATERfP
Passes if ( f2reffP & f2maskfP ) > ( f2stencilfP & f2maskfP ).
%f3GL_GEQUALfP
Passes if ( f2reffP & f2maskfP ) (>= ( f2stencilfP & f2maskfP ).
%f3GL_EQUALfP
Passes if ( f2reffP & f2maskfP ) = ( f2stencilfP & f2maskfP ).
%f3GL_NOTEQUALfP
Passes if ( f2reffP & f2maskfP ) (!= ( f2stencilfP & f2maskfP ).
%f3GL_ALWAYSfP
Always passes.
 

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 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


 

Index

NAME
C SPECIFICATION
DESCRIPTION
NOTES
ERRORS
ASSOCIATED GETS
SEE ALSO