Sets the front and/or back function and reference value for stencil testing.
SyntaxWebGLRenderingContext.stencilFuncSeparate(face, func, ref, mask);
- face [in]
Specifies whether front and/or back stencil state is updated.
- func [in]
Specifies the test function. The initial value is ALWAYS
- ref [in]
Specifies the reference value for the stencil test. ref is clamped to the range [0, 2⁽ⁿ ⁻ ¹⁾], where n is the number of stencil bits for both the front and back-facing stencil bits. The stencil reference values for the front and back-facing stencil buffers (respectively STENCIL_REF and STENCIL_BACK_REF) default to 0.
- mask [in]
Specifies a mask that is bit-wise ANDed with both the reference value and the stored stencil value when the test is done. The initial value is composed entirely of 1's.
This method does not return a value.
Write operations on the front-facing stencil buffer do not affect the contents of the back-facing stencil buffer (and vice-versa).
You can set the same stencil function on both the front and back-facing stencil buffers by calling stencilFuncSeparate with face set to FRONT_AND_BACK.
Calling stencilFuncSeparate with an invalid face enumeration value generates the INVALID_ENUM error code.
Calling stencilFuncSeparate with an invalid func enumeration value generates the INVALID_ENUMerror code and doesn’t affect any previously set parameter value on either the front or back-facing stencil buffers.
Different stencil reference and mask values can be set on the front and back-facing stencil buffers without generating an error, but attempting to render generates the INVALID_OPERATION error and does not affect the contents of the WebGL viewport.