<?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>glColorMaterial</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="glColorMask.3G.xml" title="glColorMask"/><link rel="next" href="glColorPointer.3G.xml" title="glColorPointer"/></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">glColorMaterial</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glColorMask.3G.xml">Prev</a> </td><th width="60%" align="center">GL</th><td width="20%" align="right"> <a accesskey="n" href="glColorPointer.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glColorMaterial.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glColorMaterial.3G-name"/><h2>Name</h2><p>glColorMaterial &#8212; cause a material color to track the current color</p></div><div class="refsynopsisdiv"><a name="glColorMaterial.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glColorMaterial</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>face</tt></i>, GLenum <i><tt>mode</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glColorMaterial.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glColorMaterial</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>face</tt></i>, <i><tt>mode</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glColorMaterial.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>face</tt></i></span></dt><dd>
						Specifies whether front, back, or both front and back material parameters should track the current color.
						Accepted values are <tt>GL_FRONT</tt>, <tt>GL_BACK</tt>, and
						<tt>GL_FRONT_AND_BACK</tt>. The initial value is <tt>GL_FRONT_AND_BACK</tt>.
					</dd><dt><span class="term"><i><tt>mode</tt></i></span></dt><dd>
						Specifies which of several material parameters track the current color. Accepted values are
						<tt>GL_EMISSION</tt>, <tt>GL_AMBIENT</tt>, <tt>GL_DIFFUSE</tt>,
						<tt>GL_SPECULAR</tt>, and <tt>GL_AMBIENT_AND_DIFFUSE</tt>. The initial value is
						<tt>GL_AMBIENT_AND_DIFFUSE</tt>.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glColorMaterial.3G-description"/><h2>Description</h2><p>
			<tt>glColorMaterial</tt> specifies which material parameters track the current color. When
			<tt>GL_COLOR_MATERIAL</tt> is enabled, the material parameter or parameters specified by
			<i><tt>mode</tt></i>, of the material or materials specified by <i><tt>face</tt></i>, track the current
			color at all times.
		</p><p>
			To enable and disable <tt>GL_COLOR_MATERIAL</tt>, call <a href="glEnable.3G.xml"><tt>glEnable</tt></a>
			and <a href="glEnable.3G.xml"><tt>glDisable</tt></a> with argument <tt>GL_COLOR_MATERIAL</tt>.
			<tt>GL_COLOR_MATERIAL</tt> is initially disabled.
		</p></div><div class="refsect1" lang="en"><a name="glColorMaterial.3G-notes"/><h2>Notes</h2><p>
			<tt>glColorMaterial</tt> makes it possible to change a subset of material parameters for each vertex using
			only the <tt>glColor</tt> command, without calling <tt>glMaterial</tt>. If only such a subset of parameters is to be specified for each vertex,
			calling <tt>glColorMaterial</tt> is preferable to calling <tt>glMaterial</tt>.
		</p><p>
			Call <tt>glColorMaterial</tt> before enabling <tt>GL_COLOR_MATERIAL</tt>.
		</p><p>
			Calling <a href="glDrawElements.3G.xml"><tt>glDrawElements</tt></a>, <a href="glDrawArrays.3G.xml"><tt>glDrawArrays</tt></a>,
			or <a href="glDrawRangeElements.3G.xml"><tt>glDrawRangeElements</tt></a> may leave the current color indeterminate, if the color
			array is enabled. If <tt>glColorMaterial</tt> is enabled while the current color is indeterminate, the
			lighting material state specified by <i><tt>face</tt></i> and <i><tt>mode</tt></i> is also indeterminate.
		</p><p>
			If the GL version is 1.1 or greater, and <tt>GL_COLOR_MATERIAL</tt> is enabled, evaluated color values
			affect the results of the lighting equation as if the current color were being modified, but no change is made to the
			tracking lighting parameter of the current color.
		</p></div><div class="refsect1" lang="en"><a name="glColorMaterial.3G-errors"/><h2>Errors</h2><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>face</tt></i> or <i><tt>mode</tt></i> is not
			an accepted value.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <tt>glColorMaterial</tt> is executed 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>.
		</p></div><div class="refsect1" lang="en"><a name="glColorMaterial.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<a href="glIsEnabled.3G.xml"><tt>glIsEnabled</tt></a> with argument <tt>GL_COLOR_MATERIAL</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_COLOR_MATERIAL_PARAMETER</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_COLOR_MATERIAL_FACE</tt>
		</p></div><div class="refsect1" lang="en"><a name="glColorMaterial.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glColor.3G.xml">glColor</a>, <a href="glColorPointer.3G.xml">glColorPointer</a>, <a href="glDrawArrays.3G.xml">glDrawArrays</a>, <a href="glDrawElements.3G.xml">glDrawElements</a>, <a href="glDrawRangeElements.3G.xml">glDrawRangeElements</a>, <a href="glEnable.3G.xml">glEnable</a>, <a href="glLight.3G.xml">glLight</a>, <a href="glLightModel.3G.xml">glLightModel</a>, <a href="glMaterial.3G.xml">glMaterial</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="glColorMask.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="glColorPointer.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glColorMask </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> glColorPointer</td></tr></table></div></body></html>