glColor — set the current color

C Specification

void glColor4f(GLfloat red,
 GLfloat green,
 GLfloat blue,
 GLfloat alpha);
void glColor4x(GLfixed red,
 GLfixed green,
 GLfixed blue,
 GLfixed alpha);
void glColor4ub(GLubyte red,
 GLubyte green,
 GLubyte blue,
 GLubyte alpha);


red, green, blue, alpha

Specify new red, green, blue, and alpha values for the current color.


glColor sets a new four-valued current RGBA color.

Current color values are stored in fixed-point or floating-point. In case the values are stored in floating-point, the mantissa and exponent sizes are unspecified.

Neither fixed-point nor floating-point values are clamped to the range [0, 1] before the current color is updated. However, color components are clamped to this range before they are interpolated or written into the color buffer.

Unsigned byte color components specified with glColor4ub are linearly mapped to floating-point values such that 255 maps to 1.0 (full intensity), and 0 maps to 0.0 (zero intensity).


The initial value for the current color is (1, 1, 1, 1).

Associated Gets

glGet with argument GL_CURRENT_COLOR

See Also

glColorPointer, glNormal, glMultiTexCoord


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