glStencilFunc Function

Syntax

GL_APICALL void GL_APIENTRY glStencilFunc(
     GLenum func,
     GLint ref,
     GLuint mask
);

Parameters

Name Description
in func Comparison function
in ref Reference value
in mask Mask value

Return Values

No values are returned.

Description

Configures the comparison function, reference value, and mask value used by the stencil test.

You can set func to GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GREATER, GL_GEQUAL, or GL_NOTEQUAL. Set ref to the reference value. Set mask to the mask value.

Given a stencil buffer value of stencil, the stencil test passes or fails according to the following conditions specified by func.

GL_NEVERThe stencil test always fails.
GL_ALWAYSThe stencil test always passes.
GL_LESSPasses when (ref & mask) < (stencil & mask).
GL_LEQUALPasses when (ref & mask) <= (stencil & mask).
GL_EQUALPasses when (ref & mask) == (stencil & mask).
GL_GREATERPasses when (ref & mask) > (stencil & mask).
GL_GEQUALPasses when (ref & mask) >= (stencil & mask).
GL_NOTEQUALPasses when (ref & mask) != (stencil & mask).

This function generates the following errors.

GL_INVALID_ENUMThe func argument was set to an invalid value.
GL_INVALID_OPERATIONThis function was called without any command-list objects bound.

Revision History

2010/01/07
Initial version.

CONFIDENTIAL