
<refentry id="glPushName">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glPushName</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glPushName</refname>
        <refpurpose>push and pop the name stack</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glPushName</function></funcdef>
                <paramdef>GLuint <parameter>name</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>name</parameter></term>
            <listitem>
                <para>
                    Specifies a name that will be pushed onto the name stack.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glPopName</function></funcdef>
                <paramdef> <parameter>void</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 id="description"><title>Description</title>
        <para>
            The name stack is used during selection mode to allow sets of rendering
            commands to be uniquely identified.
            It consists of an ordered set of unsigned integers and is initially empty.
        </para>
        <para>
            <function>glPushName</function> causes <parameter>name</parameter> to be pushed onto the name stack.
            <citerefentry><refentrytitle>glPopName</refentrytitle></citerefentry> pops one name off the top of the stack.
        </para>
        <para>
            The maximum name stack depth is implementation-dependent; call
            <constant>GL_MAX_NAME_STACK_DEPTH</constant> to find out the value for a particular
            implementation. It is an
            error to push a name onto a full stack
            or to pop a name off an empty stack.
            It is also an error to manipulate the name stack between the execution of
            <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
            In any of these cases, the error flag is set and no other change is
            made to GL state.
        </para>
        <para>
            The name stack is always empty while the render mode is not <constant>GL_SELECT</constant>.
            Calls to <function>glPushName</function> or <citerefentry><refentrytitle>glPopName</refentrytitle></citerefentry> while the render mode is not
            <constant>GL_SELECT</constant> are ignored.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_STACK_OVERFLOW</constant> is generated if <function>glPushName</function> is called while the
            name stack is full.
        </para>
        <para>
            <constant>GL_STACK_UNDERFLOW</constant> is generated if <citerefentry><refentrytitle>glPopName</refentrytitle></citerefentry> is called while the
            name stack is empty.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <function>glPushName</function> or <citerefentry><refentrytitle>glPopName</refentrytitle></citerefentry>
            is executed 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_NAME_STACK_DEPTH</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_MAX_NAME_STACK_DEPTH</constant>
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glInitNames</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glLoadName</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glRenderMode</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glSelectBuffer</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>
