stencilMaskSeparate method

Controls the front and/or back writing of individual bits in the stencil planes.




WebGLRenderingContext.stencilMaskSeparate(face, mask);


face [in]

Type: number

Specifies whether the front and/or back stencil write mask is updated.

mask [in]

Type: number

Specifies a bit mask to enable and disable writing of individual bits in the stencil planes. Initially, the mask is composed entirely of 1's.

Return value

This method does not return a value.


Different write masks can be set on the front and back-facing stencil buffers, but attempting to render will generate the INVALID_OPERATION error and does not affect the contents of the WebGL viewport.

Stencil buffer boundary regions can be written to (that is, corner areas).

The stencil buffer isn’t modified when a rendering error occurs.

Stencil buffer values are clamped to the range [0, 2⁽ⁿ ⁻ ¹⁾], where n is the size of the stencil buffer (in bits).

See also