glClear  3UGD2W5

[New - Windows 95, OEM Service Release 2]

The glClear function clears buffers within the viewport.

void glClear(

    GLbitfield mask

 

   );

 

 

Parameters

mask

Bitwise OR of masks that indicate the buffers to be cleared. The four masks are as follows.

Mask

Buffer to be Cleared

GL_COLOR_BUFFER_BIT

The buffers currently enabled for color writing.

GL_DEPTH_BUFFER_BIT

The depth buffer.

GL_ACCUM_BUFFER_BIT

The accumulation buffer.

GL_STENCIL_BUFFER_BIT

The stencil buffer.

 

Remarks

The glClear function sets the bitplane area of the window to values previously selected by glClearColor3OOM00K, glClearIndex4B3X1H6, glClearDepth4AYO_VQ, glClearStencilX5JF07, and glClearAccum1N1H2PA. You can clear multiple color buffers simultaneously by selecting more than one buffer at a time using glDrawBufferXDQ_WV.

The pixel-ownership test, the scissor test, dithering, and the buffer writemasks affect the operation of glClear. The scissor box bounds the cleared region. The alpha function, blend function, logical operation, stenciling, texture mapping, and z-buffering are ignored by glClear.

The glClear function takes a single argument (mask) that is the bitwise OR of several values indicating which buffer is to be cleared.

The value to which each buffer is cleared depends on the setting of the clear value for that buffer.

If a buffer is not present, a glClear call directed at that buffer has no effect.

The following functions retrieve information related to glClear:

glGet8KNKTW with argument GL_ACCUM_CLEAR_VALUE

glGet with argument GL_DEPTH_CLEAR_VALUE

glGet with argument GL_INDEX_CLEAR_VALUE

glGet with argument GL_COLOR_CLEAR_VALUE

glGet with argument GL_STENCIL_CLEAR_VALUE

 

Error Codes

The following are the error codes generated and their conditions.

Error Code

Condition

GL_INVALID_VALUE

Any bit other than the four defined bits was set in mask.

GL_INVALID_OPERATION

glClear was called between a call to glBegin and the corresponding call to glEnd.

 

See Also

glClearAccum, glClearColor, glClearDepth, glClearIndex, glClearStencil, glDrawBuffer, glGet, glScissor