stencilOpSeparate method

Sets front and/or back stencil test actions.




WebGLRenderingContext.stencilOpSeparate(face, fail, zfail, zpass);


face [in]

Type: number

Specifies whether front and/or back stencil state is updated.

fail [in]

Type: number

Specifies the action to take when the stencil test fails.

zfail [in]

Type: number

Specifies the stencil action when the stencil test passes, but the depth test fails.

zpass [in]

Type: number

Specifies the stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled.

Return value

This method does not return a value.


Different values can be set on both the front and back-facing stencil buffers for each of the parameters and are leveraged during rendering.

Calling stencilOpSeparate with an invalid face enumeration value will generate a WebGL INVALID_ENUM error.

See also