glClearColor function

The glClearColor function specifies clear values for the color buffers.

Syntax

void WINAPI glClearColor(
   GLclampf red,
   GLclampf green,
   GLclampf blue,
   GLclampf alpha
);

Parameters

red

The red value that glClear uses to clear the color buffers. The default value is zero.

green

The green value that glClear uses to clear the color buffers. The default value is zero.

blue

The blue value that glClear uses to clear the color buffers. The default value is zero.

alpha

The alpha value that glClear uses to clear the color buffers. The default value is zero.

Return value

This function does not return a value.

Error codes

The following error codes 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 glClearColor function specifies the red, green, blue, and alpha values used by glClear to clear the color buffers. Values specified by glClearColor are clamped to the range [0,1].

The following functions retrieve information related to the glClearColor function:

glGet with argument GL_ACCUM_CLEAR_VALUE

glGet with argument GL_COLOR_CLEAR_VALUE

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

glClear

glEnd

glGet