<?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>glLightModel</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /></head><body><div class="refentry"><a id="glLightModel"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glLightModel — set the lighting model parameters</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">glLightModelf</strong>(</code></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" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">glLightModelx</strong>(</code></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"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">
                    <em class="parameter"><code>pname</code></em>
                </span></dt><dd><p>Specifies a single-valued lighting model parameter.  Must be
                    <code class="constant">GL_LIGHT_MODEL_TWO_SIDE</code>.</p></dd><dt><span class="term">
                    <em class="parameter"><code>param</code></em>
                </span></dt><dd><p>Specifies the value that <em class="parameter"><code>param</code></em>
                    will be set to.</p></dd></dl></div></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">glLightModelfv</strong>(</code></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" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">glLightModelxv</strong>(</code></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"><a id="parameters2"></a><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">
                    <em class="parameter"><code>pname</code></em>
                </span></dt><dd><p>Specifies a lighting model parameter.
                    <code class="constant">GL_LIGHT_MODEL_AMBIENT</code> and
                    <code class="constant">GL_LIGHT_MODEL_TWO_SIDE</code> are accepted.</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>params</code></em> will be set to.</p></dd></dl></div></div><div class="refsect1"><a id="description"></a><h2>Description</h2><p><code class="function">glLightModel</code> sets the lighting model parameter.
        <em class="parameter"><code>pname</code></em> names a parameter and
        <em class="parameter"><code>params</code></em>
        gives the new value. There are two lighting model parameters:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
                    <code class="constant">GL_LIGHT_MODEL_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 intensity of the entire scene.
                    The values are not clamped. The initial value is
                    (0.2, 0.2, 0.2, 1.0).</p></dd><dt><span class="term">
                    <code class="constant">GL_LIGHT_MODEL_TWO_SIDE</code>
                </span></dt><dd><p><em class="parameter"><code>params</code></em>
                    is a single fixed-point or floating-point value that
                    specifies whether one- or two-sided lighting calculations
                    are done for polygons. It has no effect on the lighting
                    calculations for points or lines. If
                    <em class="parameter"><code>params</code></em>
                    is 0, one-sided lighting is specified, and both front- and
                    back-facing polygons are assigned the same computed color.
                    Otherwise, two-sided lighting is specified. In this case,
                    vertices of back-facing polygons have their normals reversed
                    before the lighting equation is evaluated. Vertices of
                    front-facing polygons are always lighted with no change to 
                    their normals. The initial value is 0. Note that there is
                    only one set of material properties shared by both
                    front- and back-facing polygons.</p></dd></dl></div><p>The lighted color of a vertex is the sum of the material
        emission intensity, the product of the material ambient
        reflectance and the lighting model full-scene ambient
        intensity, and the contribution of each enabled light source.
        Each light source contributes the sum of three terms: ambient,
        diffuse, and specular. The ambient light source contribution is
        the product of the material ambient reflectance and the light's
        ambient intensity. The diffuse light source contribution is the
        product of the material diffuse reflectance, the light's
        diffuse intensity, and the dot product of the vertex's normal
        with the normalized vector from the vertex to the light source.
        The specular light source contribution is the product of the
        material specular reflectance, the light's specular intensity,
        and the dot product of the normalized vertex-to-eye and
        vertex-to-light vectors, raised to the power of the shininess
        of the material. All three light source contributions are
        attenuated equally based on the distance from the vertex to the
        light source and on light source direction, spread exponent,
        and spread cutoff angle. All dot products are replaced with 0
        if they evaluate to a negative value.</p><p>The alpha component of the resulting lighted color is set
        to the alpha value of the material diffuse reflectance.</p></div><div class="refsect1"><a id="errors"></a><h2>Errors</h2><p><code class="constant">GL_INVALID_ENUM</code> is generated if
        <em class="parameter"><code>pname</code></em> is not an accepted value.</p></div><div class="refsect1"><a id="seealso"></a><h2>See Also</h2><p>
        <a class="citerefentry" href="glLight.xml"><span class="citerefentry"><span class="refentrytitle">glLight</span></span></a>,
        <a class="citerefentry" href="glMaterial.xml"><span class="citerefentry"><span class="refentrytitle">glMaterial</span></span></a>
        </p></div><div class="refsect1"><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>