| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
| 2 | <!-- saved from url=(0013)about:internet --> |
| 3 | <?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" /><title>glGetAttribLocation</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></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 |
| 4 | 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 |
| 5 | the name of the attribute variable whose location is |
| 6 | 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 |
| 7 | previously linked program object specified by |
| 8 | <em class="parameter"><code>program</code></em> for the attribute variable |
| 9 | specified by <em class="parameter"><code>name</code></em> and returns the index |
| 10 | of the generic vertex attribute that is bound to that attribute |
| 11 | variable. If <em class="parameter"><code>name</code></em> is a matrix attribute |
| 12 | variable, the index of the first column of the matrix is |
| 13 | returned. If the named attribute variable is not an active |
| 14 | attribute in the specified program object or if |
| 15 | <em class="parameter"><code>name</code></em> starts with the reserved prefix |
| 16 | "gl_", a value of -1 is returned.</p><p>The association between an attribute variable name and a |
| 17 | generic attribute index can be specified at any time by calling |
| 18 | <a class="citerefentry" href="glBindAttribLocation.xml"><span class="citerefentry"><span class="refentrytitle">glBindAttribLocation</span></span></a>. |
| 19 | Attribute bindings do not go into effect until |
| 20 | <a class="citerefentry" href="glLinkProgram.xml"><span class="citerefentry"><span class="refentrytitle">glLinkProgram</span></span></a> |
| 21 | is called. After a program object has been linked successfully, |
| 22 | the index values for attribute variables remain fixed until the |
| 23 | next link command occurs. The attribute values can only be |
| 24 | queried after a link if the link was successful. |
| 25 | <code class="function">glGetAttribLocation</code> returns the binding |
| 26 | that actually went into effect the last time |
| 27 | <a class="citerefentry" href="glLinkProgram.xml"><span class="citerefentry"><span class="refentrytitle">glLinkProgram</span></span></a> |
| 28 | was called for the specified program object. Attribute bindings |
| 29 | that have been specified since the last link operation are not |
| 30 | returned by <code class="function">glGetAttribLocation</code>.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p><code class="function">glGetAttribLocation</code> is available only |
| 31 | if the GL version is 2.0 or greater.</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 |
| 32 | <em class="parameter"><code>program</code></em> is not a value generated by |
| 33 | OpenGL.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if |
| 34 | <em class="parameter"><code>program</code></em> is not a program object.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if |
| 35 | <em class="parameter"><code>program</code></em> has not been successfully |
| 36 | linked.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if |
| 37 | <code class="function">glGetAttribLocation</code> is executed between the |
| 38 | execution of |
| 39 | <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> |
| 40 | and the corresponding execution of |
| 41 | <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p><a class="citerefentry" href="glGetActiveAttrib.xml"><span class="citerefentry"><span class="refentrytitle">glGetActiveAttrib</span></span></a> |
| 42 | with argument <em class="parameter"><code>program</code></em> and the index of an |
| 43 | active attribute</p><p><a class="citerefentry" 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 class="citerefentry" href="glBindAttribLocation.xml"><span class="citerefentry"><span class="refentrytitle">glBindAttribLocation</span></span></a>, |
| 44 | <a class="citerefentry" href="glLinkProgram.xml"><span class="citerefentry"><span class="refentrytitle">glLinkProgram</span></span></a>, |
| 45 | <a class="citerefentry" href="glVertexAttrib.xml"><span class="citerefentry"><span class="refentrytitle">glVertexAttrib</span></span></a>, |
| 46 | <a class="citerefentry" 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> |
| 47 | Copyright <span class="trademark"></span>© 2003-2005 3Dlabs Inc. Ltd. |
| 48 | This material may be distributed subject to the terms and conditions set forth in |
| 49 | the Open Publication License, v 1.0, 8 June 1999. |
| 50 | <a class="ulink" href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>. |
| 51 | </p></div></div></body></html> |