<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
<!-- saved from url=(0013)about:internet -->
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>glMaterial</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div class="refentry" title="glMaterial"><a id="glMaterial"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glMaterial — specify material parameters for the lighting model</p></div><div class="refsynopsisdiv" title="C Specification"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <strong>fsfuncglMaterialf</strong>(</code></td><td>GLenum <var class="pdparam">face</var>, </td></tr><tr><td> </td><td>GLenum <var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLfloat <var class="pdparam">param</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <strong>fsfuncglMaterialx</strong>(</code></td><td>GLenum <var class="pdparam">face</var>, </td></tr><tr><td> </td><td>GLenum <var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLfixed <var class="pdparam">param</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Parameters"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term">
                    <em class="parameter"><code>face</code></em>
                </span></dt><dd><p>Specifies which face or faces are being updated. Must be
                    <code class="constant">GL_FRONT_AND_BACK</code>.</p></dd><dt><span class="term">
                    <em class="parameter"><code>pname</code></em>
                </span></dt><dd><p>Specifies the single-valued material parameter of
                    the face or faces that is being updated. Must be
                    <code class="constant">GL_SHININESS</code>.</p></dd><dt><span class="term">
                    <em class="parameter"><code>param</code></em>
                </span></dt><dd><p>Specifies the value that parameter
                    <code class="constant">GL_SHININESS</code> will be set to.</p></dd></dl></div></div><div class="refsynopsisdiv" title="C Specification"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <strong>fsfuncglMaterialfv</strong>(</code></td><td>GLenum <var class="pdparam">face</var>, </td></tr><tr><td> </td><td>GLenum <var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLfloat * <var class="pdparam">params</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <strong>fsfuncglMaterialxv</strong>(</code></td><td>GLenum <var class="pdparam">face</var>, </td></tr><tr><td> </td><td>GLenum <var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLfixed * <var class="pdparam">params</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Parameters"><a id="parameters2"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term">
                    <em class="parameter"><code>face</code></em>
                </span></dt><dd><p>Specifies which face or faces are being updated.
                        Must be <code class="constant">GL_FRONT_AND_BACK</code>.
                    </p></dd><dt><span class="term">
                    <em class="parameter"><code>pname</code></em>
                </span></dt><dd><p>Specifies the material parameter of the face or
                    faces that is being updated. Must be one of
                    <code class="constant">GL_AMBIENT</code>,
                    <code class="constant">GL_DIFFUSE</code>,
                    <code class="constant">GL_SPECULAR</code>,
                    <code class="constant">GL_EMISSION</code>,
                    <code class="constant">GL_SHININESS</code>, or
                    <code class="constant">GL_AMBIENT_AND_DIFFUSE</code>.</p></dd><dt><span class="term">
                    <em class="parameter"><code>params</code></em>
                </span></dt><dd><p>Specifies a pointer to the value or values that
                    <em class="parameter"><code>pname</code></em>

                    will be set to.</p></dd></dl></div></div><div class="refsect1" title="Description"><a id="description"></a><h2>Description</h2><p>
        <code class="function">glMaterial</code>
        assigns values to material parameters.  There are two matched
        sets of material parameters. One, the <em class="parameter"><code>front-facing</code></em>
        set, is used to shade points, lines, and all polygons (when
        two-sided lighting is disabled), or just front-facing polygons
        (when two-sided lighting is enabled). The other set,
        <em class="parameter"><code>back-facing</code></em>,
        is used to shade back-facing polygons only when two-sided
        lighting is enabled. Refer to the
        <a class="citerefentry" href="glLightModel.xml"><span class="citerefentry"><span class="refentrytitle">glLightModel</span></span></a>
        reference page for details concerning one- and two-sided
        lighting calculations.
        </p><p>
        <code class="function">glMaterial</code>
        takes three arguments. The first, <em class="parameter"><code>face</code></em>,
        must be <code class="constant">GL_FRONT_AND_BACK</code> and specifies that both
        front and back materials will be modified.
        The second, <em class="parameter"><code>pname</code></em>,
        specifies which of several parameters in one or both sets
        will be modified. The third, <em class="parameter"><code>params</code></em>,
        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
        <a class="citerefentry" href="glLightModel.xml"><span class="citerefentry"><span class="refentrytitle">glLightModel</span></span></a>
        reference page. The parameters that can be specified using
        <code class="function">glMaterial</code>,
        and their interpretations by the lighting equation, are as follows:
        </p><div class="variablelist"><dl><dt><span class="term">
                    <code class="constant">GL_AMBIENT</code>
                </span></dt><dd><p><em class="parameter"><code>params</code></em>
                    contains four fixed-point or floating-point values that
                    specify the ambient RGBA reflectance of the material.
                    The values are not clamped. The initial ambient
                    reflectance  is
                    (0.2, 0.2, 0.2, 1.0).</p></dd><dt><span class="term">
                    <code class="constant">GL_DIFFUSE</code>
                </span></dt><dd><p><em class="parameter"><code>params</code></em>
                    contains four fixed-point or floating-point values that
                    specify the diffuse RGBA reflectance of the material.
                    The values are not clamped. The initial diffuse
                    reflectance  is
                    (0.8, 0.8, 0.8, 1.0).</p></dd><dt><span class="term">
                    <code class="constant">GL_SPECULAR</code>
                </span></dt><dd><p><em class="parameter"><code>params</code></em>
                    contains four fixed-point or floating-point values that
                    specify the specular RGBA reflectance of the material.
                    The values are not clamped. The initial specular
                    reflectance  is
                    (0, 0, 0, 1).</p></dd><dt><span class="term">
                    <code class="constant">GL_EMISSION</code>
                </span></dt><dd><p><em class="parameter"><code>params</code></em>
                    contains four fixed-point or floating-point values that
                    specify the RGBA emitted light intensity of the material.
                    The values are not clamped. The initial emission
                    intensity  is
                    (0, 0, 0, 1).</p></dd><dt><span class="term">
                    <code class="constant">GL_SHININESS</code>
                </span></dt><dd><p><em class="parameter"><code>params</code></em>
                    is a single fixed-point or floating-point value that
                    specifies the RGBA specular exponent of the material.
                    Only values in the range [0, 128] are accepted. The
                    initial specular exponent  is 0.</p></dd><dt><span class="term">
                    <code class="constant">GL_AMBIENT_AND_DIFFUSE</code>
                </span></dt><dd><p>Equivalent to calling <code class="function">glMaterial</code>
                    twice with the same parameter values, once with
                    <code class="constant">GL_AMBIENT</code>
                    and once with <code class="constant">GL_DIFFUSE</code>.</p></dd></dl></div></div><div class="refsect1" title="Notes"><a id="notes"></a><h2>Notes</h2><p>To change the diffuse and ambient material per vertex,
        color material can be used.
        To enable and disable
        <code class="constant">GL_COLOR_MATERIAL</code>, call
        <a class="citerefentry" href="glEnable.xml"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a> and
        <a class="citerefentry" href="glDisable.xml"><span class="citerefentry"><span class="refentrytitle">glDisable</span></span></a> with
        argument <code class="constant">GL_COLOR_MATERIAL</code>.
        Color material is initially disabled.
        </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" title="Errors"><a id="errors"></a><h2>Errors</h2><p>
            <code class="constant">GL_INVALID_ENUM</code> is generated if either
            <em class="parameter"><code>face</code></em> or <em class="parameter"><code>pname</code></em>
            is not an accepted value.
        </p><p>
            <code class="constant">GL_INVALID_VALUE</code>
            is generated if a specular exponent outside the range [0, 128]
            is specified.
        </p></div><div class="refsect1" title="Associated Gets"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
            <a class="citerefentry" href="glGetMaterial.xml"><span class="citerefentry"><span class="refentrytitle">glGetMaterial</span></span></a>
        </p></div><div class="refsect1" title="See Also"><a id="seealso"></a><h2>See Also</h2><p>
            <a class="citerefentry" href="glEnable.xml"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a>,
            <a class="citerefentry" href="glLight.xml"><span class="citerefentry"><span class="refentrytitle">glLight</span></span></a>,
            <a class="citerefentry" href="glLightModel.xml"><span class="citerefentry"><span class="refentrytitle">glLightModel</span></span></a>
        </p></div><div class="refsect1" title="Copyright"><a id="copyright"></a><h2>Copyright</h2><p>
            Copyright <span class="trademark"></span>© 2003-2004
            Silicon Graphics, Inc. This document is licensed under the SGI
            Free Software B License. For details, see
            <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
        </p></div></div></body></html>
