# glStencilFunc

set front and back function and reference value for stencil testing

## Signature

glStencilFunc( GLenum ( func ) , GLint ( ref ) , GLuint ( mask ) )-> void
glStencilFunc( func , ref , )

## Parameters

VariablesDescription
func
Specifies the test function. Eight symbolic constants are valid: GL_NEVER , GL_LESS , GL_LEQUAL , GL_GREATER , GL_GEQUAL , GL_EQUAL , GL_NOTEQUAL , and GL_ALWAYS . The initial value is GL_ALWAYS .
ref
Specifies the reference value for the stencil test. ref is clamped to the range $0 2 n - 1$ , where $n$ is the number of bitplanes in the stencil buffer. The initial value is 0.
mask
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.

## Sample Code References

The following code samples have been found which appear to reference the functions described here. Take care that the code may be old, broken or not even use PyOpenGL.

glStencilFunc
OpenGLContext OpenGLContext/shadow/passes.py Lines: 127, 246, 314, 351
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson26.py Lines: 150, 158
{LGPL} PyMT pymt/graphx/stencil.py Lines: 21, 46, 81, 95, 109
{LGPL} Pyggel pyggel/misc.py Lines: 27, 38