<?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>glGetLight</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /></head><body><div class="refentry"><a id="glGetLight"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glGetLight — return light source parameter values</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">glGetLightfv</strong>(</code></td><td>GLenum <var class="pdparam">light</var>, </td></tr><tr><td> </td><td>GLenum <var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLfloat * <var class="pdparam">params</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><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">glGetLightiv</strong>(</code></td><td>GLenum <var class="pdparam">light</var>, </td></tr><tr><td> </td><td>GLenum <var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLint * <var class="pdparam">params</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>light</code></em></span></dt><dd><p>
                    Specifies a light source.
                    The number of possible lights depends on the implementation,
                    but at least eight lights are supported.
                    They are identified by symbolic names of the form <code class="constant">GL_LIGHT</code>
                    <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">i</mml:mi></mml:math>
                    where 
                    <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">i</mml:mi></mml:math>
                    ranges from 0 to the value of <code class="constant">GL_MAX_LIGHTS</code> - 1.
                </p></dd><dt><span class="term"><em class="parameter"><code>pname</code></em></span></dt><dd><p>
                    Specifies a light source parameter for <em class="parameter"><code>light</code></em>.
                    Accepted symbolic names are
                    <code class="constant">GL_AMBIENT</code>,
                    <code class="constant">GL_DIFFUSE</code>,
                    <code class="constant">GL_SPECULAR</code>,
                    <code class="constant">GL_POSITION</code>,
                    <code class="constant">GL_SPOT_DIRECTION</code>,
                    <code class="constant">GL_SPOT_EXPONENT</code>,
                    <code class="constant">GL_SPOT_CUTOFF</code>,
                    <code class="constant">GL_CONSTANT_ATTENUATION</code>,
                    <code class="constant">GL_LINEAR_ATTENUATION</code>, and
                    <code class="constant">GL_QUADRATIC_ATTENUATION</code>.
                </p></dd><dt><span class="term"><em class="parameter"><code>params</code></em></span></dt><dd><p>
                    Returns the requested data.
                </p></dd></dl></div></div><div class="refsect1"><a id="description"></a><h2>Description</h2><p>
            <code class="function">glGetLight</code> returns in <em class="parameter"><code>params</code></em> the value or values of a light source parameter.
            <em class="parameter"><code>light</code></em> names the light and is a symbolic name of the form <code class="constant">GL_LIGHT</code>
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">i</mml:mi></mml:math>
            where i ranges from 0 to the value of <code class="constant">GL_MAX_LIGHTS</code> - 1.
            <code class="constant">GL_MAX_LIGHTS</code> is an implementation dependent constant that is
            greater than or equal to eight.
            <em class="parameter"><code>pname</code></em> specifies one of ten light source parameters,
            again by symbolic name.
        </p><p>
            The following parameters are defined:
        </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">GL_AMBIENT</code></span></dt><dd><p>
                        <em class="parameter"><code>params</code></em> returns four integer or floating-point values representing the
                        ambient intensity of the light source.
                        Integer values,
                        when requested,
                        are linearly mapped from the internal floating-point representation
                        such that 1.0 maps to the most positive representable integer value,
                        and 
                        <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                            
                            <mml:mn>-1.0</mml:mn>
                        </mml:math>
                        maps to the most negative representable integer value.
                        If the internal value is outside the range 
                        <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                            
                            <mml:mfenced open="[" close="]">
                                <mml:mn>-1</mml:mn>
                                <mml:mn>1</mml:mn>
                            </mml:mfenced>
                        </mml:math>,
                        the corresponding integer return value is undefined. The initial value is
                        (0, 0, 0, 1).
                    </p></dd><dt><span class="term"><code class="constant">GL_DIFFUSE</code></span></dt><dd><p>
                        <em class="parameter"><code>params</code></em> returns four integer or floating-point values representing the
                        diffuse intensity of the light source.
                        Integer values,
                        when requested,
                        are linearly mapped from the internal floating-point representation
                        such that 1.0 maps to the most positive representable integer value,
                        and 
                        <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                            
                            <mml:mn>-1.0</mml:mn>
                        </mml:math>
                        maps to the most negative representable integer value.
                        If the internal value is outside the range 
                        <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                            
                            <mml:mfenced open="[" close="]">
                                <mml:mn>-1</mml:mn>
                                <mml:mn>1</mml:mn>
                            </mml:mfenced>
                        </mml:math>,
                        the corresponding integer return value is undefined. The initial value
                        for <code class="constant">GL_LIGHT0</code> is (1, 1, 1, 1); for other lights, the
                        initial value is (0, 0, 0, 0).
                    </p></dd><dt><span class="term"><code class="constant">GL_SPECULAR</code></span></dt><dd><p>
                        <em class="parameter"><code>params</code></em> returns four integer or floating-point values representing the
                        specular intensity of the light source.
                        Integer values,
                        when requested,
                        are linearly mapped from the internal floating-point representation
                        such that 1.0 maps to the most positive representable integer value,
                        and 
                        <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                            
                            <mml:mn>-1.0</mml:mn>
                        </mml:math>
                        maps to the most negative representable integer value.
                        If the internal value is outside the range 
                        <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                            
                            <mml:mfenced open="[" close="]">
                                <mml:mn>-1</mml:mn>
                                <mml:mn>1</mml:mn>
                            </mml:mfenced>
                        </mml:math>,
                        the corresponding integer return value is undefined. The initial value
                        for <code class="constant">GL_LIGHT0</code> is (1, 1, 1, 1); for other lights, the
                        initial value is (0, 0, 0, 0).
                    </p></dd><dt><span class="term"><code class="constant">GL_POSITION</code></span></dt><dd><p>
                        <em class="parameter"><code>params</code></em> returns four integer or floating-point values representing the
                        position of the light source.
                        Integer values,
                        when requested,
                        are computed by rounding the internal floating-point values to the
                        nearest integer value.
                        The returned values are those maintained in eye coordinates.
                        They will not be equal to the values specified using <a class="citerefentry" href="glLight.xml"><span class="citerefentry"><span class="refentrytitle">glLight</span></span></a>,
                        unless the modelview matrix was identity at the time <a class="citerefentry" href="glLight.xml"><span class="citerefentry"><span class="refentrytitle">glLight</span></span></a> was
                        called. The initial value is (0, 0, 1, 0).
                    </p></dd><dt><span class="term"><code class="constant">GL_SPOT_DIRECTION</code></span></dt><dd><p>
                        <em class="parameter"><code>params</code></em> returns three integer or floating-point values representing the
                        direction of the light source.
                        Integer values,
                        when requested,
                        are computed by rounding the internal floating-point values to the
                        nearest integer value.
                        The returned values are those maintained in eye coordinates.
                        They will not be equal to the values specified using <a class="citerefentry" href="glLight.xml"><span class="citerefentry"><span class="refentrytitle">glLight</span></span></a>,
                        unless the modelview matrix was identity at the time <a class="citerefentry" href="glLight.xml"><span class="citerefentry"><span class="refentrytitle">glLight</span></span></a> was called.
                        Although spot direction is normalized before being used in the lighting
                        equation,
                        the returned values are the transformed versions of the specified values
                        prior to normalization. The initial value is 
                        <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                            
                            <mml:mfenced open="(" close=")">
                                <mml:mn>0</mml:mn>
                                <mml:mn>0</mml:mn>
                                <mml:mn>-1</mml:mn>
                            </mml:mfenced>
                        </mml:math>.
                    </p></dd><dt><span class="term"><code class="constant">GL_SPOT_EXPONENT</code></span></dt><dd><p>
                        <em class="parameter"><code>params</code></em> returns a single integer or floating-point value representing the
                        spot exponent of the light.
                        An integer value,
                        when requested,
                        is computed by rounding the internal floating-point representation to
                        the nearest integer. The initial value is 0.
                    </p></dd><dt><span class="term"><code class="constant">GL_SPOT_CUTOFF</code></span></dt><dd><p>
                        <em class="parameter"><code>params</code></em> returns a single integer or floating-point value representing the
                        spot cutoff angle of the light.
                        An integer value,
                        when requested,
                        is computed by rounding the internal floating-point representation to
                        the nearest integer. The initial value is 180.
                    </p></dd><dt><span class="term"><code class="constant">GL_CONSTANT_ATTENUATION</code></span></dt><dd><p>
                        <em class="parameter"><code>params</code></em> returns a single integer or floating-point value representing the
                        constant (not distance-related) attenuation of the light.
                        An integer value,
                        when requested,
                        is computed by rounding the internal floating-point representation to
                        the nearest integer. The initial value is 1.
                    </p></dd><dt><span class="term"><code class="constant">GL_LINEAR_ATTENUATION</code></span></dt><dd><p>
                        <em class="parameter"><code>params</code></em> returns a single integer or floating-point value representing the
                        linear attenuation of the light.
                        An integer value,
                        when requested,
                        is computed by rounding the internal floating-point representation to
                        the nearest integer. The initial value is 0.
                    </p></dd><dt><span class="term"><code class="constant">GL_QUADRATIC_ATTENUATION</code></span></dt><dd><p>
                        <em class="parameter"><code>params</code></em> returns a single integer or floating-point value representing the
                        quadratic attenuation of the light.
                        An integer value,
                        when requested,
                        is computed by rounding the internal floating-point representation to
                        the nearest integer. The initial value is 0.
                    </p></dd></dl></div></div><div class="refsect1"><a id="notes"></a><h2>Notes</h2><p>
            It is always the case that <code class="constant">GL_LIGHT</code>
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">i</mml:mi></mml:math>
            = <code class="constant">GL_LIGHT0</code> + 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">i</mml:mi></mml:math>.
        </p><p>
            If an error is generated,
            no change is made to the contents of <em class="parameter"><code>params</code></em>.
        </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>light</code></em> or <em class="parameter"><code>pname</code></em> is not an
            accepted value.
        </p><p>
            <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glGetLight</code>
            is executed between the execution of <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a>
            and the corresponding execution of <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.
        </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>
        </p></div><div class="refsect1"><a id="Copyright"></a><h2>Copyright</h2><p>
            Copyright <span class="trademark"></span>© 1991-2006
            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>