glColorMask — enable and disable writing of color buffer components

C Specification

void glColorMask(GLboolean red,
 GLboolean green,
 GLboolean blue,
 GLboolean alpha);


red, green, blue, alpha

Specify whether red, green, blue, and alpha can or cannot be written into the color buffer. The initial values are all GL_TRUE, indicating that all color components can be written.


glColorMask specifies whether the individual components in the color buffer can or cannot be written. If red is GL_FALSE, for example, no change is made to the red component of any pixel in the color buffer, regardless of the drawing operation attempted, including glClear.

Changes to individual bits of components cannot be controlled. Rather, changes are either enabled or disabled for entire color components.

See Also

glClear, glColor, glColorPointer, glDepthMask, glStencilMask


Copyright © 2003-2004 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see