<?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>glColorPointer</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="glColorMaterial.3G.xml" title="glColorMaterial"/><link rel="next" href="glColorSubTable.3G.xml" title="glColorSubTable"/></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">glColorPointer</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glColorMaterial.3G.xml">Prev</a> </td><th width="60%" align="center">GL</th><td width="20%" align="right"> <a accesskey="n" href="glColorSubTable.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glColorPointer.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glColorPointer.3G-name"/><h2>Name</h2><p>glColorPointer, glColorPointerb, glColorPointerf, glColorPointerd, glColorPointeri, glColorPointers, glColorPointerub, glColorPointerui, glColorPointerus &#8212; define an array of colors</p></div><div class="refsynopsisdiv"><a name="glColorPointer.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glColorPointer</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLint <i><tt>size</tt></i>, GLenum <i><tt>type</tt></i>, GLsizei <i><tt>stride</tt></i>, const GLvoid *<i><tt>pointer</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glColorPointer.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glColorPointer</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>size</tt></i>, <i><tt>type</tt></i>, <i><tt>stride</tt></i>, <i><tt>pointer</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColorPointerb</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>pointer</tt></i>[][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColorPointerd</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>pointer</tt></i>[][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColorPointerf</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>pointer</tt></i>[][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColorPointeri</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>pointer</tt></i>[][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColorPointers</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>pointer</tt></i>[][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColorPointerub</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>pointer</tt></i>[][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColorPointerui</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>pointer</tt></i>[][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glColorPointerus</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>pointer</tt></i>[][]) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glColorPointer.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>size</tt></i></span></dt><dd>
						Specifies the number of components per color. Must be 3 or 4. The initial value is 4.
					</dd><dt><span class="term"><i><tt>type</tt></i></span></dt><dd>
						Specifies the data type of each color component in the array. Symbolic constants
						<tt>GL_BYTE</tt>, <tt>GL_UNSIGNED_BYTE</tt>, <tt>GL_SHORT</tt>,
						<tt>GL_UNSIGNED_SHORT</tt>, <tt>GL_INT</tt>, <tt>GL_UNSIGNED_INT</tt>,
						<tt>GL_FLOAT</tt>, and <tt>GL_DOUBLE</tt> are accepted. The initial value is
						<tt>GL_FLOAT</tt>.
					</dd><dt><span class="term"><i><tt>stride</tt></i></span></dt><dd>
						Specifies the byte offset between consecutive colors. If <i><tt>stride</tt></i> is 0 (the initial
						value), the colors are understood to be tightly packed in the array. The initial value is 0.
					</dd><dt><span class="term"><i><tt>pointer</tt></i></span></dt><dd>
						Specifies a pointer to the first component of the first color element in the array.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glColorPointer.3G-description"/><h2>Description</h2><p>
			<tt>glColorPointer</tt> specifies the location and data of an array of color components to use when
			rendering. <i><tt>size</tt></i> specifies the number of components per color, and must be 3 or 4.
			<i><tt>type</tt></i> specifies the data type of each color component, and <i><tt>stride</tt></i>
			specifies the byte stride from one color to the next allowing vertexes and attributes to be packed into a single array
			or stored in separate arrays. (Single-array storage may be more efficient on some implementations; see <a href="glInterleavedArrays.3G.xml">glInterleavedArrays</a>.)
		</p><p>
			When a color array is specified, <i><tt>size</tt></i>, <i><tt>type</tt></i>,
			<i><tt>stride</tt></i>, and <i><tt>pointer</tt></i> are saved as client-side state.
		</p><p>
			To enable and disable the color array, call <a href="glEnableClientState.3G.xml"><tt>glEnableClientState</tt></a> and
		</p><p>
			<a href="glEnableClientState.3G.xml"><tt>glDisableClientState</tt></a> with the argument <tt>GL_COLOR_ARRAY</tt>. If
			enabled, the color array is used when <a href="glDrawArrays.3G.xml"><tt>glDrawArrays</tt></a>, <a href="glDrawElements.3G.xml"><tt>glDrawElements</tt></a>, <a href="glDrawRangeElements.3G.xml"><tt>glDrawRangeElements</tt></a>, or
			<a href="glArrayElement.3G.xml"><tt>glArrayElement</tt></a> is called.
		</p></div><div class="refsect1" lang="en"><a name="glColorPointer.3G-notes"/><h2>Notes</h2><p>
			<tt>glColorPointer</tt> is available only if the GL version is 1.1 or greater.
		</p><p>
			The color array is initially disabled and isn't accessed when <a href="glArrayElement.3G.xml"><tt>glArrayElement</tt></a>,
			<a href="glDrawArrays.3G.xml"><tt>glDrawArrays</tt></a>, <a href="glDrawRangeElements.3G.xml"><tt>glDrawRangeElements</tt></a>, or
			<a href="glDrawElements.3G.xml"><tt>glDrawElements</tt></a> is called.
		</p><p>
			Execution of <tt>glColorPointer</tt> is not allowed between the execution of <a href="glBegin.3G.xml"><tt>glBegin</tt></a> and the corresponding execution of <a href="glBegin.3G.xml"><tt>glEnd</tt></a>, but an error may or may not be generated. If no error is generated, the operation
			is undefined.
		</p><p>
			<tt>glColorPointer</tt> is typically implemented on the client side.
		</p><p>
			Color array parameters are client-side state and are therefore not saved or restored by <a href="glPushAttrib.3G.xml"><tt>glPushAttrib</tt></a> and <a href="glPushAttrib.3G.xml"><tt>glPopAttrib</tt></a>. Use <a href="glPushClientAttrib.3G.xml"><tt>glPushClientAttrib</tt></a> and <a href="glPushClientAttrib.3G.xml"><tt>glPopClientAttrib</tt></a>
			instead.
		</p></div><div class="refsect1" lang="en"><a name="glColorPointer.3G-errors"/><h2>Errors</h2><p>
			<tt>GL_INVALID_VALUE</tt> is generated if <i><tt>size</tt></i> is not 3 or 4.
		</p><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>type</tt></i> is not an accepted value.
		</p><p>
			<tt>GL_INVALID_VALUE</tt> is generated if <i><tt>stride</tt></i> is negative.
		</p></div><div class="refsect1" lang="en"><a name="glColorPointer.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<a href="glIsEnabled.3G.xml"><tt>glIsEnabled</tt></a> with argument <tt>GL_COLOR_ARRAY</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_COLOR_ARRAY_SIZE</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_COLOR_ARRAY_TYPE</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_COLOR_ARRAY_STRIDE</tt>
		</p><p>
			<a href="glGetPointerv.3G.xml"><tt>glGetPointerv</tt></a> with argument <tt>GL_COLOR_ARRAY_POINTER</tt>
		</p></div><div class="refsect1" lang="en"><a name="glColorPointer.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glArrayElement.3G.xml">glArrayElement</a>, <a href="glDrawArrays.3G.xml">glDrawArrays</a>, <a href="glDrawElements.3G.xml">glDrawElements</a>, <a href="glEdgeFlagPointer.3G.xml">glEdgeFlagPointer</a>, <a href="glEnable.3G.xml">glEnable</a>, <a href="glGetPointerv.3G.xml">glGetPointerv</a>, <a href="glIndexPointer.3G.xml">glIndexPointer</a>, <a href="glInterleavedArrays.3G.xml">glInterleavedArrays</a>, <a href="glNormalPointer.3G.xml">glNormalPointer</a>, <a href="glPushClientAttrib.3G.xml">glPushClientAttrib</a>, <a href="glTexCoordPointer.3G.xml">glTexCoordPointer</a>, <a href="glVertexPointer.3G.xml">glVertexPointer</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="glColorMaterial.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="glColorSubTable.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glColorMaterial </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> glColorSubTable</td></tr></table></div></body></html>
