
<refentry id="glSecondaryColor">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glSecondaryColor</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glSecondaryColor</refname>
        <refpurpose>set the current secondary color</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3b</function></funcdef>
                <paramdef>GLbyte <parameter>red</parameter></paramdef>
                <paramdef>GLbyte <parameter>green</parameter></paramdef>
                <paramdef>GLbyte <parameter>blue</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3s</function></funcdef>
                <paramdef>GLshort <parameter>red</parameter></paramdef>
                <paramdef>GLshort <parameter>green</parameter></paramdef>
                <paramdef>GLshort <parameter>blue</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3i</function></funcdef>
                <paramdef>GLint <parameter>red</parameter></paramdef>
                <paramdef>GLint <parameter>green</parameter></paramdef>
                <paramdef>GLint <parameter>blue</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3f</function></funcdef>
                <paramdef>GLfloat <parameter>red</parameter></paramdef>
                <paramdef>GLfloat <parameter>green</parameter></paramdef>
                <paramdef>GLfloat <parameter>blue</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3d</function></funcdef>
                <paramdef>GLdouble <parameter>red</parameter></paramdef>
                <paramdef>GLdouble <parameter>green</parameter></paramdef>
                <paramdef>GLdouble <parameter>blue</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3ub</function></funcdef>
                <paramdef>GLubyte <parameter>red</parameter></paramdef>
                <paramdef>GLubyte <parameter>green</parameter></paramdef>
                <paramdef>GLubyte <parameter>blue</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3us</function></funcdef>
                <paramdef>GLushort <parameter>red</parameter></paramdef>
                <paramdef>GLushort <parameter>green</parameter></paramdef>
                <paramdef>GLushort <parameter>blue</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3ui</function></funcdef>
                <paramdef>GLuint <parameter>red</parameter></paramdef>
                <paramdef>GLuint <parameter>green</parameter></paramdef>
                <paramdef>GLuint <parameter>blue</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <!-- eqn: ignoring delim $$ -->
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>red</parameter></term>
            <term><parameter>green</parameter></term>
            <term><parameter>blue</parameter></term>
            <listitem>
                <para>
                    Specify new red, green, and blue values for the current secondary color.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3bv</function></funcdef>
                <paramdef>const GLbyte * <parameter>v</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3sv</function></funcdef>
                <paramdef>const GLshort * <parameter>v</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3iv</function></funcdef>
                <paramdef>const GLint * <parameter>v</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3fv</function></funcdef>
                <paramdef>const GLfloat * <parameter>v</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3dv</function></funcdef>
                <paramdef>const GLdouble * <parameter>v</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3ubv</function></funcdef>
                <paramdef>const GLubyte * <parameter>v</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3usv</function></funcdef>
                <paramdef>const GLushort * <parameter>v</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glSecondaryColor3uiv</function></funcdef>
                <paramdef>const GLuint * <parameter>v</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 id="parameters2"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>v</parameter></term>
            <listitem>
                <para>
                    Specifies a pointer to an array that contains red, green, blue.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            The GL stores both a primary four-valued RGBA color and a
            secondary four-valued RGBA color (where alpha is always set to 0.0) that is
            associated with every vertex.
        </para>
        <para>
            The secondary color is interpolated and applied to each fragment during
            rasterization when <constant>GL_COLOR_SUM</constant> is enabled.  When lighting is enabled,
            and <constant>GL_SEPARATE_SPECULAR_COLOR</constant> is specified, the value of the
            secondary color is assigned the value computed from the specular term of
            the lighting computation. Both the primary and secondary current colors are
            applied to each fragment, regardless of the state of <constant>GL_COLOR_SUM</constant>,
            under such conditions.  When <constant>GL_SEPARATE_SPECULAR_COLOR</constant> is specified,
            the value returned from querying the current secondary color is undefined.
        </para>
        <para>
            <function>glSecondaryColor3b</function>, <function>glSecondaryColor3s</function>, and
            <function>glSecondaryColor3i</function> take three signed byte, short, or long integers as
            arguments.  When <emphasis role="bold">v</emphasis> is appended to the name, the color commands can
            take a pointer to an array of such values.
        </para>
        <para>
            Color values are stored in floating-point format, with
            unspecified mantissa and exponent sizes.  Unsigned integer color
            components, when specified, are linearly mapped to floating-point values
            such that the largest representable value maps to 1.0 (full intensity), and
            0 maps to 0.0 (zero intensity).  Signed integer color components, when
            specified, are linearly mapped to floating-point values such that the most
            positive representable value maps to 1.0, and the most negative
            representable value maps to 
            <inlineequation><mml:math>
                <!-- eqn: -1.0:-->
                <mml:mn>-1.0</mml:mn>
            </mml:math></inlineequation>.
            (Note that this mapping does not convert
            0 precisely to 0.0).  Floating-point values are mapped directly.
        </para>
        <para>
            Neither floating-point nor signed integer values are clamped to the range
            <inlineequation><mml:math>
                <!-- eqn: [0,1]:-->
                <mml:mfenced open="[" close="]">
                    <mml:mn>0</mml:mn>
                    <mml:mn>1</mml:mn>
                </mml:mfenced>
            </mml:math></inlineequation>
            before the current color is updated.  However, color components are
            clamped to this range before they are interpolated or written into a color
            buffer.
        </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            <function>glSecondaryColor</function> is available only if the GL version is 1.4 or greater.
        </para>
        <para>
            The initial value for the secondary color is (0, 0, 0, 0).
        </para>
        <para>
            The secondary color can be updated at any time.  In particular, <function>glSecondaryColor</function> can
            be called between a call to <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding call to
            <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
        </para>
    </refsect1>
    <refsect1 id="associatedgets"><title>Associated Gets</title>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_SECONDARY_COLOR</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_RGBA_MODE</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_COLOR_SUM</constant>
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glColor</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glIndex</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glLightModel</refentrytitle></citerefentry>,
            <function>glSecondaryColorPointer</function>
        </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>
