<!DOCTYPE refentry [ <!ENTITY % mathent SYSTEM "math.ent"> %mathent; ]>

<!-- Converted by db4-upgrade version 1.1 -->

<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="glGetAttribLocation">
    <refmeta>
        <refentrytitle>glGetAttribLocation</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glGetAttribLocation</refname>
        <refpurpose>Returns the location of an attribute variable</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>C Specification</title>
    <funcsynopsis>
        <funcprototype>
        <funcdef>GLint <function>glGetAttribLocation</function></funcdef>
        <paramdef>GLuint <parameter>program</parameter></paramdef>
        <paramdef>const GLchar *<parameter>name</parameter></paramdef>
        </funcprototype>
    </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 xml:id="parameters"><title>Parameters</title>
    <variablelist>
        <varlistentry>
        <term><parameter>program</parameter></term>
        <listitem>
            <para>Specifies the program object to be
            queried.</para>
        </listitem>
        </varlistentry>
        <varlistentry>
        <term><parameter>name</parameter></term>
        <listitem>
            <para>Points to a null terminated string containing
            the name of the attribute variable whose location is
            to be queried.</para>
        </listitem>
        </varlistentry>
    </variablelist>
    </refsect1>
    <refsect1 xml:id="description"><title>Description</title>
    <para><function>glGetAttribLocation</function> queries the
    previously linked program object specified by
    <parameter>program</parameter> for the attribute variable
    specified by <parameter>name</parameter> and returns the index
    of the generic vertex attribute that is bound to that attribute
    variable. If <parameter>name</parameter> is a matrix attribute
    variable, the index of the first column of the matrix is
    returned. If the named attribute variable is not an active
    attribute in the specified program object or if
    <parameter>name</parameter> starts with the reserved prefix
    &quot;gl_&quot;, a value of -1 is returned.</para>

    <para>The association between an attribute variable name and a
    generic attribute index can be specified at any time by calling
    <citerefentry><refentrytitle>glBindAttribLocation</refentrytitle></citerefentry>.
    Attribute bindings do not go into effect until
    <citerefentry><refentrytitle>glLinkProgram</refentrytitle></citerefentry>
    is called. After a program object has been linked successfully,
    the index values for attribute variables remain fixed until the
    next link command occurs. The attribute values can only be
    queried after a link if the link was successful.
    <function>glGetAttribLocation</function> returns the binding
    that actually went into effect the last time
    <citerefentry><refentrytitle>glLinkProgram</refentrytitle></citerefentry>
    was called for the specified program object. Attribute bindings
    that have been specified since the last link operation are not
    returned by <function>glGetAttribLocation</function>.</para>
    </refsect1>
    <refsect1 xml:id="errors"><title>Errors</title>
    <para><constant>GL_INVALID_OPERATION</constant> is generated if
    <parameter>program</parameter> is not a value generated by
    OpenGL.</para>

    <para><constant>GL_INVALID_OPERATION</constant> is generated if
    <parameter>program</parameter> is not a program object.</para>

    <para><constant>GL_INVALID_OPERATION</constant> is generated if
    <parameter>program</parameter> has not been successfully
    linked.</para>

    </refsect1>
    <refsect1 xml:id="associatedgets"><title>Associated Gets</title>
    <para><citerefentry><refentrytitle>glGetActiveAttrib</refentrytitle></citerefentry>
    with argument <parameter>program</parameter> and the index of an
    active attribute</para>

    <para><citerefentry><refentrytitle>glIsProgram</refentrytitle></citerefentry></para>
    </refsect1>
    <refsect1 xml:id="versions">
        <title>API Version Support</title>
        <informaltable>
            <tgroup cols="4" align="left">
                <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apifunchead.xml" xpointer="xpointer(/*/*)"/>
                <tbody>
                    <row>
                        <entry><function>glGetAttribLocation</function></entry>
                        <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apiversion.xml" xpointer="xpointer(/*/*[@role='es20']/*)"/>
                    </row>
                </tbody>
            </tgroup>
        </informaltable>
    </refsect1>
    <refsect1 xml:id="seealso"><title>See Also</title>
    <para><citerefentry><refentrytitle>glBindAttribLocation</refentrytitle></citerefentry>,
    <citerefentry><refentrytitle>glIsProgram</refentrytitle></citerefentry>,
    <citerefentry><refentrytitle>glLinkProgram</refentrytitle></citerefentry>,
    <citerefentry><refentrytitle>glVertexAttrib</refentrytitle></citerefentry>,
    <citerefentry><refentrytitle>glVertexAttribPointer</refentrytitle></citerefentry></para>
    </refsect1>
    <refsect1 xml:id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"/> 2003-2005 3Dlabs Inc. Ltd. 
            This material may be distributed subject to the terms and conditions set forth in 
            the Open Publication License, v 1.0, 8 June 1999.
            <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://opencontent.org/openpub/">http://opencontent.org/openpub/</link>.
        </para>
    </refsect1>
</refentry>
