glStencilMask

The glStencilMask function controls the writing of individual bits in the stencil planes.

void glStencilMask(
  GLuint mask);

Parameters

  • mask
    A bit mask to enable and disable writing of individual bits in the stencil planes. Initially, the mask is all ones.

Remarks

The glStencilMask function controls the writing of individual bits in the stencil planes. The least significant n bits of mask, where n is the number of bits in the stencil buffer, specify a mask. Wherever a one appears in the mask, the corresponding bit in the stencil buffer is made writable. Where a zero appears, the bit is write-protected. Initially, all bits are enabled for writing.

The following functions retrieve information related to glStencilMask:

glGet with argument GL_STENCIL_WRITEMASK

glGet with argument GL_STENCIL_BITS

Error Codes

The following is the error code and its condition.

Error code Condition
GL_INVALID_OPERATION glStencilMask was called between a call to glBegin and the corresponding call to glEnd.

Requirements

**  Windows NT/2000:** Requires Windows NT 3.5 or later.
**  Windows 95/98:** Requires Windows 95 or later. Available as a redistributable for Windows 95.
**  Header:** Declared in Gl.h.
**  Library:** Use Opengl32.lib.

See Also

glBegin, glColorMask, glDepthMask, glEnd, glIndexMask, glStencilFunc, glStencilOp