<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:mml="http://www.w3.org/1998/Math/MathML"
><head><title>glColor</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"/><link rel="home" href="index.xml" title="PyOpenGL 2.0.1.07 Man Pages"/><link rel="up" href="reference-GL.xml" title="GL"/><link rel="previous" href="glClipPlane.3G.xml" title="glClipPlane"/><link rel="next" href="glColorMask.3G.xml" title="glColorMask"/></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">glColor</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glClipPlane.3G.xml">Prev</a> </td><th width="60%" align="center">GL</th><td width="20%" align="right"> <a accesskey="n" href="glColorMask.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glColor.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glColor.3G-name"/><h2>Name</h2><p>glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us, glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us, glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv, glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv, glColor4uiv, glColor4usv &#8212; set the current color</p></div><div class="refsynopsisdiv"><a name="glColor.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glColor3b</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLbyte <i><tt>red</tt></i>, GLbyte <i><tt>green</tt></i>, GLbyte <i><tt>blue</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3d</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLdouble <i><tt>red</tt></i>, GLdouble <i><tt>green</tt></i>, GLdouble <i><tt>blue</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3f</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLfloat <i><tt>red</tt></i>, GLfloat <i><tt>green</tt></i>, GLfloat <i><tt>blue</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3i</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLint <i><tt>red</tt></i>, GLint <i><tt>green</tt></i>, GLint <i><tt>blue</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3s</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLshort <i><tt>red</tt></i>, GLshort <i><tt>green</tt></i>, GLshort <i><tt>blue</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3ub</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLubyte <i><tt>red</tt></i>, GLubyte <i><tt>green</tt></i>, GLubyte <i><tt>blue</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3ui</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLuint <i><tt>red</tt></i>, GLuint <i><tt>green</tt></i>, GLuint <i><tt>blue</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3us</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLushort <i><tt>red</tt></i>, GLushort <i><tt>green</tt></i>, GLushort <i><tt>blue</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4b</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLbyte <i><tt>red</tt></i>, GLbyte <i><tt>green</tt></i>, GLbyte <i><tt>blue</tt></i>, GLbyte <i><tt>alpha</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4d</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLdouble <i><tt>red</tt></i>, GLdouble <i><tt>green</tt></i>, GLdouble <i><tt>blue</tt></i>, GLdouble <i><tt>alpha</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4f</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLfloat <i><tt>red</tt></i>, GLfloat <i><tt>green</tt></i>, GLfloat <i><tt>blue</tt></i>, GLfloat <i><tt>alpha</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4i</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLint <i><tt>red</tt></i>, GLint <i><tt>green</tt></i>, GLint <i><tt>blue</tt></i>, GLint <i><tt>alpha</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4s</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLshort <i><tt>red</tt></i>, GLshort <i><tt>green</tt></i>, GLshort <i><tt>blue</tt></i>, GLshort <i><tt>alpha</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4ub</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLubyte <i><tt>red</tt></i>, GLubyte <i><tt>green</tt></i>, GLubyte <i><tt>blue</tt></i>, GLubyte <i><tt>alpha</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4ui</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLuint <i><tt>red</tt></i>, GLuint <i><tt>green</tt></i>, GLuint <i><tt>blue</tt></i>, GLuint <i><tt>alpha</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4us</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLushort <i><tt>red</tt></i>, GLushort <i><tt>green</tt></i>, GLushort <i><tt>blue</tt></i>, GLushort <i><tt>alpha</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glColor.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glColor3b</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3d</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3f</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3i</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3s</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3ub</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3ui</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3us</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4b</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>, <i><tt>alpha</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4d</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>, <i><tt>alpha</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4f</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>, <i><tt>alpha</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4i</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>, <i><tt>alpha</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4s</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>, <i><tt>alpha</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4ub</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>, <i><tt>alpha</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4ui</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>, <i><tt>alpha</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4us</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i>, <i><tt>alpha</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glColor.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>red</tt></i>, <i><tt>green</tt></i>, <i><tt>blue</tt></i></span></dt><dd>
						Specify new red, green, and blue values for the current color.
					</dd><dt><span class="term"><i><tt>alpha</tt></i></span></dt><dd>
						Specifies a new alpha value for the current color. Included only in the four-argument <tt>glColor4</tt> commands.
					</dd></dl></div></div><div class="refsynopsisdiv"><a name="glColor.3G-c_spec-v"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glColor3bv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLbyte *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3dv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLdouble *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3fv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLfloat *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3iv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLint *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3sv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLshort *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3ubv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLubyte *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3uiv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLuint *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor3usv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLushort *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4bv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLbyte *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4dv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLdouble *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4fv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLfloat *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4iv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLint *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4sv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLshort *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4ubv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLubyte *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4uiv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLuint *<i><tt>v</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glColor4usv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>const GLushort *<i><tt>v</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glColor.3G-python_spec-v"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glColor3bv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3dv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3fv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3iv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3sv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3ubv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3uiv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor3usv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4bv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4dv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4fv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4iv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4sv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4ubv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4uiv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColor4usv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>v</tt></i>[]) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glColor.3G-parameters-v"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>v</tt></i></span></dt><dd>
						Specifies a pointer to an array that contains red, green, blue, and (sometimes) alpha values.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glColor.3G-description"/><h2>Description</h2><p>
			The GL stores both a current single-valued color index and a current four-valued RGBA color. <tt>glColor</tt> sets a new four-valued RGBA color. <tt>glColor</tt> has two major variants: <tt>glColor3</tt> and
			<tt>glColor4</tt>. <tt>glColor3</tt> variants specify
			new red, green, and blue values explicitly and set the current alpha value to 1.0 (full intensity) implicitly.
			<tt>glColor4</tt> variants specify all four color components explicitly.
		</p><p>
			<tt>glColor3b</tt>, <tt>glColor4b</tt>, <tt>glColor3s</tt>,
			<tt>glColor4s</tt>, <tt>glColor3i</tt>, and <tt>glColor4i</tt> take three or four
			signed byte, short, or long integers as arguments. When <span class="bold"><b>v</b></span> is appended to the name, the
			color commands can take a pointer to an array of such values.
		</p><p>
			Current color values are stored in floating-point , with unspecified mantissa and exponent sizes. Unsigned integer
			color components, when specified, are linearly mapped to floating-point values such that the largest representable
			value maps to 1.0 (full intensity), and 0 maps to 0.0 (zero intensity). Signed integer color components, when
			specified, are linearly mapped to floating-point values such that the most positive representable value maps to 1.0,
			and the most negative representable value maps to -1.0. (Note that this mapping does not convert 0 precisely to 0.0.)
			Floating-point values are mapped directly.
		</p><p>
			Neither floating-point nor signed integer 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 a color buffer.
		</p></div><div class="refsect1" lang="en"><a name="glColor.3G-notes"/><h2>Notes</h2><p>
			The initial value for the current color is (1, 1, 1, 1).
		</p><p>
			The current color can be updated at any time. In particular, <tt>glColor</tt> can be
			called between a call to <a href="glBegin.3G.xml"><tt>glBegin</tt></a> and the corresponding call to <a href="glBegin.3G.xml"><tt>glEnd</tt></a>.
		</p></div><div class="refsect1" lang="en"><a name="glColor.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<tt>glGet</tt> with argument <tt>GL_CURRENT_COLOR</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_RGBA_MODE</tt>
		</p></div><div class="refsect1" lang="en"><a name="glColor.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glIndex.3G.xml">glIndex</a></span>
		</p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="glClipPlane.3G.xml">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-GL.xml">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="glColorMask.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glClipPlane </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> glColorMask</td></tr></table></div></body></html>