Rediger

Del via


glColorMask function

The glColorMask function enables and disables writing of frame-buffer color components.

Syntax

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

Parameters

red

Specify whether red can or cannot be written into the framebuffer. The default values is GL_TRUE, indicating that the color component can be written.

green

Specify whether green can or cannot be written into the framebuffer. The default value is GL_TRUE, indicating that the color component can be written.

blue

Specify whether blue can or cannot be written into the framebuffer. The default value is GL_TRUE, indicating that the color component can be written.

alpha

Specify whether alpha can or cannot be written into the framebuffer. The default value is GL_TRUE, indicating that the color component can be written.

Return value

This function does not return a value.

Error codes

The following error code can be retrieved by the glGetError function.

Name Meaning
GL_INVALID_OPERATION
The function was called between a call to glBegin and the corresponding call to glEnd.

Remarks

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

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

The following functions retrieve information related to glColorMask:

glGet with argument GL_COLOR_WRITEMASK

glGet with argument GL_RGBA_MODE

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Gl.h
Library
Opengl32.lib
DLL
Opengl32.dll

See also

glBegin

glColor

glDepthMask

glEnd

glGet

glIndex

glIndexMask

glStencilMask