
<refentry id="glArrayElement">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glArrayElement</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glArrayElement</refname>
        <refpurpose>render a vertex using the specified vertex array element</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glArrayElement</function></funcdef>
                <paramdef>GLint <parameter>i</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <!-- eqn: ignoring delim $$ -->
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>i</parameter></term>
            <listitem>
                <para>
                    Specifies an index into the enabled vertex data arrays.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glArrayElement</function> commands are used within <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry>/<citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry> pairs to
            specify vertex and attribute data for point, line, and polygon
            primitives. If <constant>GL_VERTEX_ARRAY</constant> is enabled when <function>glArrayElement</function> is called, a
            single vertex is drawn, using
            vertex and attribute data taken from location <parameter>i</parameter> of the enabled
            arrays. If <constant>GL_VERTEX_ARRAY</constant> is not enabled, no drawing occurs but
            the attributes corresponding to the enabled arrays are modified.
        </para>
        <para>
            Use <function>glArrayElement</function> to construct primitives by indexing vertex data, rather than
            by streaming through arrays of data in first-to-last order. Because
            each call specifies only a single vertex, it is possible to explicitly
            specify per-primitive attributes such as a single normal for each
            triangle.
        </para>
        <para>
            Changes made to array data between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the
            corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry> may affect calls to <function>glArrayElement</function> that are made
            within the same <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry>/<citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry> period in nonsequential ways.
            That is, a call to
            <function>glArrayElement</function> that precedes a change to array data may
            access the changed data, and a call that follows a change to array data
            may access original data.
        </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            <function>glArrayElement</function> is available only if the GL version is 1.1 or greater.
        </para>
        <para>
            <function>glArrayElement</function> is included in display lists. If <function>glArrayElement</function> is entered into a
            display list, the necessary array data (determined by the array
            pointers and enables) is also entered into the display list. Because
            the array pointers and enables are client-side state, their values
            affect display lists when the lists are created, not when the lists
            are executed.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_VALUE</constant> may be generated if <parameter>i</parameter> is negative.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to an
            enabled array and the buffer object's data store is currently mapped.
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glClientActiveTexture</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glColorPointer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDrawArrays</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glEdgeFlagPointer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glFogCoordPointer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glGetPointerv</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glIndexPointer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glInterleavedArrays</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glNormalPointer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glSecondaryColorPointer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glTexCoordPointer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glVertexPointer</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>
