<?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>glMaterial</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="glMapGrid.3G.xml" title="glMapGrid"/><link rel="next" href="glMatrixMode.3G.xml" title="glMatrixMode"/></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">glMaterial</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glMapGrid.3G.xml">Prev</a> </td><th width="60%" align="center">GL</th><td width="20%" align="right"> <a accesskey="n" href="glMatrixMode.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glMaterial.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glMaterial.3G-name"/><h2>Name</h2><p>glMaterialf, glMateriali, glMaterialfv, glMaterialiv &#8212; specify material parameters for the lighting model</p></div><div class="refsynopsisdiv"><a name="glMaterial.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glMaterialf</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>face</tt></i>, GLenum <i><tt>pname</tt></i>, GLfloat <i><tt>param</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glMateriali</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>face</tt></i>, GLenum <i><tt>pname</tt></i>, GLint <i><tt>param</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glMaterial.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glMaterialf</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>face</tt></i>, <i><tt>pname</tt></i>, <i><tt>param</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glMateriali</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>face</tt></i>, <i><tt>pname</tt></i>, <i><tt>param</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glMaterial.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>face</tt></i></span></dt><dd>
						Specifies which face or faces are being updated. Must be one of <tt>GL_FRONT</tt>,
						<tt>GL_BACK</tt>, or <tt>GL_FRONT_AND_BACK</tt>.
					</dd><dt><span class="term"><i><tt>pname</tt></i></span></dt><dd>
						Specifies the single-valued material parameter of the face or faces that is being updated. Must be
						<tt>GL_SHININESS</tt>.
					</dd><dt><span class="term"><i><tt>param</tt></i></span></dt><dd>
						Specifies the value that parameter <tt>GL_SHININESS</tt> will be set to.
					</dd></dl></div></div><div class="refsynopsisdiv"><a name="glMaterial.3G-c_spec-v"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glMaterialfv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>face</tt></i>, GLenum <i><tt>pname</tt></i>, const GLfloat *<i><tt>params</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glMaterialiv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>face</tt></i>, GLenum <i><tt>pname</tt></i>, const GLint *<i><tt>params</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glMaterial.3G-python_spec-v"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glMaterialfv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>face</tt></i>, <i><tt>pname</tt></i>, <i><tt>params</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glMaterialiv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>face</tt></i>, <i><tt>pname</tt></i>, <i><tt>params</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glMaterial.3G-parameters-v"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>face</tt></i></span></dt><dd>
						Specifies which face or faces are being updated. Must be one of <tt>GL_FRONT</tt>,
						<tt>GL_BACK</tt>, or <tt>GL_FRONT_AND_BACK</tt>.
					</dd><dt><span class="term"><i><tt>pname</tt></i></span></dt><dd>
						Specifies the material parameter of the face or faces that is being updated. Must be one of
						<tt>GL_AMBIENT</tt>, <tt>GL_DIFFUSE</tt>, <tt>GL_SPECULAR</tt>,
						<tt>GL_EMISSION</tt>, <tt>GL_SHININESS</tt>,
						<tt>GL_AMBIENT_AND_DIFFUSE</tt>, or <tt>GL_COLOR_INDEXES</tt>.
					</dd><dt><span class="term"><i><tt>params</tt></i></span></dt><dd>
						Specifies a pointer to the value or values that <i><tt>pname</tt></i> will be set to.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glMaterial.3G-description"/><h2>Description</h2><p>
			<tt>glMaterial</tt> assigns values to material parameters. There are two matched sets
			of material parameters. One, the <i><tt>front-facing</tt></i> set, is used to shade points, lines, bitmaps, and
			all polygons (when two-sided lighting is disabled), or just front-facing polygons (when two-sided lighting is enabled).
			The other set, <i><tt>back-facing</tt></i>, is used to shade back-facing polygons only when two-sided lighting
			is enabled. Refer to the <tt>glLightModel</tt> reference page for details concerning
			one- and two-sided lighting calculations.
		</p><p>
			<tt>glMaterial</tt> takes three arguments. The first, <i><tt>face</tt></i>,
			specifies whether the <tt>GL_FRONT</tt> materials, the <tt>GL_BACK</tt> materials, or both
			<tt>GL_FRONT_AND_BACK</tt> materials will be modified. The second, <i><tt>pname</tt></i>, specifies
			which of several parameters in one or both sets will be modified. The third, <i><tt>params</tt></i>, specifies
			what value or values will be assigned to the specified parameter.
		</p><p>
			Material parameters are used in the lighting equation that is optionally applied to each vertex. The equation is
			discussed in the <tt>glLightModel</tt> reference page. The parameters that can be
			specified using <tt>glMaterial</tt>, and their interpretations by the lighting
			equation, are as follows:
		</p><div class="variablelist"><dl><dt><span class="term"><tt>GL_AMBIENT</tt></span></dt><dd>
						<i><tt>params</tt></i> contains four integer or floating-point values that specify the ambient RGBA
						reflectance of the material. Integer values are mapped linearly such that the most positive representable
						value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped
						directly. Neither integer nor floating-point values are clamped. The initial ambient reflectance for both
						front- and back-facing materials is (0.2, 0.2, 0.2, 1.0).
					</dd><dt><span class="term"><tt>GL_DIFFUSE</tt></span></dt><dd>
						<i><tt>params</tt></i> contains four integer or floating-point values that specify the diffuse RGBA
						reflectance of the material. Integer values are mapped linearly such that the most positive representable
						value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped
						directly. Neither integer nor floating-point values are clamped. The initial diffuse reflectance for both
						front- and back-facing materials is (0.8, 0.8, 0.8, 1.0).
					</dd><dt><span class="term"><tt>GL_SPECULAR</tt></span></dt><dd>
						<i><tt>params</tt></i> contains four integer or floating-point values that specify the specular RGBA
						reflectance of the material. Integer values are mapped linearly such that the most positive representable
						value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped
						directly. Neither integer nor floating-point values are clamped. The initial specular reflectance for both
						front- and back-facing materials is (0, 0, 0, 1).
					</dd><dt><span class="term"><tt>GL_EMISSION</tt></span></dt><dd>
						<i><tt>params</tt></i> contains four integer or floating-point values that specify the RGBA emitted
						light intensity of the material. Integer values are mapped linearly such that the most positive
						representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point
						values are mapped directly. Neither integer nor floating-point values are clamped. The initial emission
						intensity for both front- and back-facing materials is (0, 0, 0, 1).
					</dd><dt><span class="term"><tt>GL_SHININESS</tt></span></dt><dd>
						<i><tt>params</tt></i> is a single integer or floating-point value that specifies the RGBA specular
						exponent of the material. Integer and floating-point values are mapped directly. Only values in the range
						[0,128] are accepted. The initial specular exponent for both front- and back-facing materials is 0.
					</dd><dt><span class="term"><tt>GL_AMBIENT_AND_DIFFUSE</tt></span></dt><dd>
						Equivalent to calling <tt>glMaterial</tt> twice with the same parameter
						values, once with <tt>GL_AMBIENT</tt> and once with <tt>GL_DIFFUSE</tt>.
					</dd><dt><span class="term"><tt>GL_COLOR_INDEXES</tt></span></dt><dd>
						<i><tt>params</tt></i> contains three integer or floating-point values specifying the color indices
						for ambient, diffuse, and specular lighting. These three values, and <tt>GL_SHININESS</tt>, are
						the only material values used by the color index mode lighting equation. Refer to the <tt>glLightModel</tt> reference page for a discussion of color index lighting.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glMaterial.3G-notes"/><h2>Notes</h2><p>
			The material parameters can be updated at any time. In particular, <tt>glMaterial</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>. If only a single material parameter is to be changed per vertex,
			however, <a href="glColorMaterial.3G.xml"><tt>glColorMaterial</tt></a> is preferred over <tt>glMaterial</tt> (see <a href="glColorMaterial.3G.xml">glColorMaterial</a>).
		</p><p>
			While the ambient, diffuse, specular and emission material parameters all have alpha components, only the diffuse alpha
			component is used in the lighting computation.
		</p></div><div class="refsect1" lang="en"><a name="glMaterial.3G-errors"/><h2>Errors</h2><p>
			<tt>GL_INVALID_ENUM</tt> is generated if either <i><tt>face</tt></i> or <i><tt>pname</tt></i>
			is not an accepted value.
		</p><p>
			<tt>GL_INVALID_VALUE</tt> is generated if a specular exponent outside the range [0,128] is specified.
		</p></div><div class="refsect1" lang="en"><a name="glMaterial.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<tt>glGetMaterial</tt>
		</p></div><div class="refsect1" lang="en"><a name="glMaterial.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glColorMaterial.3G.xml">glColorMaterial</a>, <a href="glLight.3G.xml">glLight</a>, <a href="glLightModel.3G.xml">glLightModel</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="glMapGrid.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="glMatrixMode.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glMapGrid </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> glMatrixMode</td></tr></table></div></body></html>
