glStencilOp Function

Syntax

GL_APICALL void GL_APIENTRY glStencilOp(
     GLenum fail,
     GLenum zfail,
     GLenum zpass
);

Arguments

Name Description
in fail Action when the stencil test fails
in zfail Action when the stencil test passes but the depth test fails
in zpass Action when the stencil and depth tests both pass

Return Values

No values are returned.

Description

Configures the actions to take on stencil buffer values.

When the stencil test fails, the action specified by fail is taken on that stencil buffer value. When the stencil test passes and the depth test fails, the action specified by zfail is taken on that stencil buffer value. When the stencil and depth tests both pass, the action specified by zpass is taken on that stencil buffer value.

Set func, zfail, and zpass using the following values.

GL_KEEPKeep the current stencil value.
GL_ZEROReplace the stencil value with 0.
GL_REPLACEReplace the stencil value with the value specified by ref in glStencilFunc.
GL_INCRIncrement the stencil value by one.
GL_DECRDecrement the stencil value by one.
GL_INVERTInvert the stencil value bitwise.
GL_INCR_WRAPIncrement the stencil value by one.
GL_DECR_WRAPDecrement the stencil value by one.

This function generates the following errors.

GL_INVALID_ENUMThe fail, zfail, or zpass 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