glClear Function

Syntax

GL_APICALL void GL_APIENTRY glClear(
     GLbitfield mask
);

Parameters

Name Description
in mask Buffer-indication bits.

Return Values

No values are returned.

Description

Clears the various buffers attached to the current framebuffer.

Set mask to a bitwise OR of any of the following values.

GL_COLOR_BUFFER_BITClear the color buffer.
GL_DEPTH_BUFFER_BITClear the depth buffer.
GL_STENCIL_BUFFER_BITClear the stencil buffer.
GL_EARLY_DEPTH_BUFFER_BIT_DMPClear the early depth buffer.

Because GL_DEPTH24_STENCIL8_EXT is the only supported stencil buffer format, if you specify GL_STENCIL_BUFFER_BIT you must also specify GL_DEPTH_BUFFER_BIT.

A value of GL_EARLY_DEPTH_BUFFER_BIT_DMP is used to clear the early depth buffer. You cannot configure the early depth buffer to be cleared from POD.

Scissoring set by glScissor and various buffer mask settings set by glColorMask, glDepthMask, and glStencilMask do not affect how the buffers are cleared by glClear. If a render buffer has not been set on the framebuffer's attachment point, clear operations are ignored.

This function generates the following errors.

GL_INVALID_VALUEThe mask argument was set to an invalid value.
GL_INVALID_OPERATIONThe mask argument specified GL_STENCIL_BUFFER_BIT without specifying GL_DEPTH_BUFFER_BIT.
GL_INVALID_OPERATIONThis function was called without any command-list objects bound.

Revision History

2010/01/07
Initial version.

CONFIDENTIAL