<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
<!-- saved from url=(0013)about:internet -->
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>glGetAttribLocation</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glGetAttribLocation"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glGetAttribLocation — Returns the location of an attribute variable</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">GLint <b class="fsfunc">glGetAttribLocation</b>(</code></td><td>GLuint  </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </td><td>const GLchar * </td><td><var class="pdparam">name</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>program</code></em></span></dt><dd><p>Specifies the program object to be
            queried.</p></dd><dt><span class="term"><em class="parameter"><code>name</code></em></span></dt><dd><p>Points to a null terminated string containing
            the name of the attribute variable whose location is
            to be queried.</p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p><code class="function">glGetAttribLocation</code> queries the
    previously linked program object specified by
    <em class="parameter"><code>program</code></em> for the attribute variable
    specified by <em class="parameter"><code>name</code></em> and returns the index
    of the generic vertex attribute that is bound to that attribute
    variable. If <em class="parameter"><code>name</code></em> 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
    <em class="parameter"><code>name</code></em> starts with the reserved prefix
    "gl_", a value of -1 is returned.</p><p>The association between an attribute variable name and a
    generic attribute index can be specified at any time by calling
    <a href="glBindAttribLocation.xml"><span class="citerefentry"><span class="refentrytitle">glBindAttribLocation</span></span></a>.
    Attribute bindings do not go into effect until
    <a href="glLinkProgram.xml"><span class="citerefentry"><span class="refentrytitle">glLinkProgram</span></span></a>
    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.
    <code class="function">glGetAttribLocation</code> returns the binding
    that actually went into effect the last time
    <a href="glLinkProgram.xml"><span class="citerefentry"><span class="refentrytitle">glLinkProgram</span></span></a>
    was called for the specified program object. Attribute bindings
    that have been specified since the last link operation are not
    returned by <code class="function">glGetAttribLocation</code>.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p><code class="constant">GL_INVALID_OPERATION</code> is generated if
    <em class="parameter"><code>program</code></em> is not a value generated by
    OpenGL.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if
    <em class="parameter"><code>program</code></em> is not a program object.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if
    <em class="parameter"><code>program</code></em> has not been successfully
    linked.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p><a href="glGetActiveAttrib.xml"><span class="citerefentry"><span class="refentrytitle">glGetActiveAttrib</span></span></a>
    with argument <em class="parameter"><code>program</code></em> and the index of an
    active attribute</p><p><a href="glIsProgram.xml"><span class="citerefentry"><span class="refentrytitle">glIsProgram</span></span></a></p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p><a href="glBindAttribLocation.xml"><span class="citerefentry"><span class="refentrytitle">glBindAttribLocation</span></span></a>,
    <a href="glLinkProgram.xml"><span class="citerefentry"><span class="refentrytitle">glLinkProgram</span></span></a>,
    <a href="glVertexAttrib.xml"><span class="citerefentry"><span class="refentrytitle">glVertexAttrib</span></span></a>,
    <a href="glVertexAttribPointer.xml"><span class="citerefentry"><span class="refentrytitle">glVertexAttribPointer</span></span></a></p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
            Copyright <span class="trademark"></span>© 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.
            <a href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>.
        </p></div></div></body></html>
