<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
              "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
<refentry id="glGetLight">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glGetLight</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glGetLight</refname>
        <refpurpose>return light source parameter values</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glGetLightfv</function></funcdef>
                <paramdef>GLenum <parameter>light</parameter></paramdef>
                <paramdef>GLenum <parameter>pname</parameter></paramdef>
                <paramdef>GLfloat * <parameter>params</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glGetLightiv</function></funcdef>
                <paramdef>GLenum <parameter>light</parameter></paramdef>
                <paramdef>GLenum <parameter>pname</parameter></paramdef>
                <paramdef>GLint * <parameter>params</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <!-- eqn: ignoring delim $$ -->
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>light</parameter></term>
            <listitem>
                <para>
                    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 <constant>GL_LIGHT</constant>
                    <inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation>
                    where 
                    <inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation>
                    ranges from 0 to the value of <constant>GL_MAX_LIGHTS</constant> - 1.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>pname</parameter></term>
            <listitem>
                <para>
                    Specifies a light source parameter for <parameter>light</parameter>.
                    Accepted symbolic names are
                    <constant>GL_AMBIENT</constant>,
                    <constant>GL_DIFFUSE</constant>,
                    <constant>GL_SPECULAR</constant>,
                    <constant>GL_POSITION</constant>,
                    <constant>GL_SPOT_DIRECTION</constant>,
                    <constant>GL_SPOT_EXPONENT</constant>,
                    <constant>GL_SPOT_CUTOFF</constant>,
                    <constant>GL_CONSTANT_ATTENUATION</constant>,
                    <constant>GL_LINEAR_ATTENUATION</constant>, and
                    <constant>GL_QUADRATIC_ATTENUATION</constant>.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>params</parameter></term>
            <listitem>
                <para>
                    Returns the requested data.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glGetLight</function> returns in <parameter>params</parameter> the value or values of a light source parameter.
            <parameter>light</parameter> names the light and is a symbolic name of the form <constant>GL_LIGHT</constant>
            <inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation>
            where i ranges from 0 to the value of <constant>GL_MAX_LIGHTS</constant> - 1.
            <constant>GL_MAX_LIGHTS</constant> is an implementation dependent constant that is
            greater than or equal to eight.
            <parameter>pname</parameter> specifies one of ten light source parameters,
            again by symbolic name.
        </para>
        <para>
            The following parameters are defined:
        </para>
        <variablelist>
            <varlistentry>
                <term><constant>GL_AMBIENT</constant></term>
                <listitem>
                    <para>
                        <parameter>params</parameter> 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 
                        <inlineequation><mml:math>
                            <!-- eqn: -1.0:-->
                            <mml:mn>-1.0</mml:mn>
                        </mml:math></inlineequation>
                        maps to the most negative representable integer value.
                        If the internal value is outside the range 
                        <inlineequation><mml:math>
                            <!-- eqn: [-1,1]:-->
                            <mml:mfenced open="[" close="]">
                                <mml:mn>-1</mml:mn>
                                <mml:mn>1</mml:mn>
                            </mml:mfenced>
                        </mml:math></inlineequation>,
                        the corresponding integer return value is undefined. The initial value is
                        (0, 0, 0, 1).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_DIFFUSE</constant></term>
                <listitem>
                    <para>
                        <parameter>params</parameter> 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 
                        <inlineequation><mml:math>
                            <!-- eqn: -1.0:-->
                            <mml:mn>-1.0</mml:mn>
                        </mml:math></inlineequation>
                        maps to the most negative representable integer value.
                        If the internal value is outside the range 
                        <inlineequation><mml:math>
                            <!-- eqn: [-1,1]:-->
                            <mml:mfenced open="[" close="]">
                                <mml:mn>-1</mml:mn>
                                <mml:mn>1</mml:mn>
                            </mml:mfenced>
                        </mml:math></inlineequation>,
                        the corresponding integer return value is undefined. The initial value
                        for <constant>GL_LIGHT0</constant> is (1, 1, 1, 1); for other lights, the
                        initial value is (0, 0, 0, 0).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_SPECULAR</constant></term>
                <listitem>
                    <para>
                        <parameter>params</parameter> 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 
                        <inlineequation><mml:math>
                            <!-- eqn: -1.0:-->
                            <mml:mn>-1.0</mml:mn>
                        </mml:math></inlineequation>
                        maps to the most negative representable integer value.
                        If the internal value is outside the range 
                        <inlineequation><mml:math>
                            <!-- eqn: [-1,1]:-->
                            <mml:mfenced open="[" close="]">
                                <mml:mn>-1</mml:mn>
                                <mml:mn>1</mml:mn>
                            </mml:mfenced>
                        </mml:math></inlineequation>,
                        the corresponding integer return value is undefined. The initial value
                        for <constant>GL_LIGHT0</constant> is (1, 1, 1, 1); for other lights, the
                        initial value is (0, 0, 0, 0).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_POSITION</constant></term>
                <listitem>
                    <para>
                        <parameter>params</parameter> 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 <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry>,
                        unless the modelview matrix was identity at the time <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry> was
                        called. The initial value is (0, 0, 1, 0).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_SPOT_DIRECTION</constant></term>
                <listitem>
                    <para>
                        <parameter>params</parameter> 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 <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry>,
                        unless the modelview matrix was identity at the time <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry> 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 
                        <inlineequation><mml:math>
                            <!-- eqn: (0, 0, -1):-->
                            <mml:mfenced open="(" close=")">
                                <mml:mn>0</mml:mn>
                                <mml:mn>0</mml:mn>
                                <mml:mn>-1</mml:mn>
                            </mml:mfenced>
                        </mml:math></inlineequation>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_SPOT_EXPONENT</constant></term>
                <listitem>
                    <para>
                        <parameter>params</parameter> 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.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_SPOT_CUTOFF</constant></term>
                <listitem>
                    <para>
                        <parameter>params</parameter> 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.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_CONSTANT_ATTENUATION</constant></term>
                <listitem>
                    <para>
                        <parameter>params</parameter> 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.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_LINEAR_ATTENUATION</constant></term>
                <listitem>
                    <para>
                        <parameter>params</parameter> 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.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_QUADRATIC_ATTENUATION</constant></term>
                <listitem>
                    <para>
                        <parameter>params</parameter> 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.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            It is always the case that <constant>GL_LIGHT</constant>
            <inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation>
            = <constant>GL_LIGHT0</constant> + 
            <inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation>.
        </para>
        <para>
            If an error is generated,
            no change is made to the contents of <parameter>params</parameter>.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>light</parameter> or <parameter>pname</parameter> is not an
            accepted value.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <function>glGetLight</function>
            is executed between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry>
            and the corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"></trademark> 1991-2006
            Silicon Graphics, Inc. This document is licensed under the SGI
            Free Software B License. For details, see
            <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
        </para>
    </refsect1>
</refentry>
