Expand Minimize

stencilFunc method

Sets the front and back function and reference value for stencil testing.

IE11

Syntax

WebGLRenderingContext.stencilFunc(func, ref, mask);

Parameters

func [in]

Type: number

Specifies the test function. The stencil functions for the front and back-facing stencil buffers (whose parameter names are STENCIL_FUNC and STENCIL_BACK_FUNC, respectively) default to ALWAYS.

ref [in]

Type: number

Specifies the reference value for the stencil test. ref is clamped to the range [0, 2(n - 1)], 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]

Type: number

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 stencil value masks for the front and back-facing stencil buffers (respectively STENCIL_VALUE_MASK and STENCIL_BACK_VALUE_MASK) default to an unsigned integer which has the n least significant bits set all to 1s (where n is the size of the stencil buffer in bits).

Return value

This method does not return a value.

Remarks

Any parameter values set via stencilFunc are set on both the front and back-facing stencil buffers.

The ref and mask values are stored in integer format and any float portion of the values are truncated.

Only the least significant n bits of the mask value are stored (where n is the size of the stencil buffer in bits).

The stencilFunc parameters (that is, STENCIL_FUNC and STENCIL_REF) can be set when the stencil test is disabled or a stencil buffer is not available, but will have no impact during rendering.

Calling stencilFunc with an invalid stencilFunc enumeration value generates the INVALID_ENUM error but doesn’t affect any previously-set parameter value.

See also

WebGLRenderingContext

 

 

Show:
© 2014 Microsoft