<?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>glGetProgramResourceLocationIndex - OpenGL 4 Reference Pages</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glGetProgramResourceLocationIndex"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glGetProgramResourceLocationIndex — query the fragment color index of a named variable within a program</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">glGetProgramResourceLocationIndex</b>(</code></td><td>GLuint  </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">programInterface</var>, </td></tr><tr><td> </td><td>const char *  </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>
                    The name of a program object whose resources to query.
                </p></dd><dt><span class="term"><em class="parameter"><code>programInterface</code></em></span></dt><dd><p>
                    A token identifying the interface within <em class="parameter"><code>program</code></em> containing the resource named <em class="parameter"><code>name</code></em>.
                </p></dd><dt><span class="term"><em class="parameter"><code>name</code></em></span></dt><dd><p>
                    The name of the resource to query the location of.
                </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
            <code class="function">glGetProgramResourceLocation</code> returns the fragment color index assigned
            to the variable named <em class="parameter"><code>name</code></em> in interface <em class="parameter"><code>programInterface</code></em> of program
            object <em class="parameter"><code>program</code></em>.  <em class="parameter"><code>program</code></em> must be the name of a program that has been
            linked successfully. <em class="parameter"><code>programInterface</code></em> must
            be one of <code class="constant">PROGRAM_OUTPUT</code>.
            The value -1 will be returned if an error occurs, if <em class="parameter"><code>name</code></em> does not identify an active variable on
            <em class="parameter"><code>programInterface</code></em>, or if <em class="parameter"><code>name</code></em> identifies an active variable that does
            not have a valid location assigned, as described above.  The locations
            returned by these commands are the same locations returned when querying
            the <code class="constant">GL_LOCATION</code> and <code class="constant">GL_LOCATION_INDEX</code> resource properties.
        </p><p>
            A string provided to <code class="function">glGetProgramResourceLocationIndex</code> is considered to match an active variable if:
        </p><div class="itemizedlist"><ul type="disc"><li><p>
                    the string exactly matches the name of the active variable
                </p></li><li><p>
                    if the string identifies the base name of an active array, where the
                    string would exactly match the name of the variable if the suffix
                    "[0]" were appended to the string
                </p></li><li><p>
                    if the string identifies an active element of the array, where the
                    string ends with the concatenation of the "[" character, an integer
                    <span class="emphasis"><em>with no "+" sign, extra leading zeroes, or whitespace</em></span> identifying an
                    array element, and the "]" character, the integer is less than the
                    number of active elements of the array variable, and where the string
                    would exactly match the enumerated name of the array if the decimal
                    integer were replaced with zero.
                </p></li></ul></div><p>
            Any other string is considered not to identify an active variable.  If the
            string specifies an element of an array variable,
            <code class="function">glGetProgramResourceLocation</code> returns the
            location assigned to that element.  If it
            specifies the base name of an array, it identifies the resources
            associated with the first element of the array.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
            <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>program</code></em>
            is not the name of an existing program object.
        </p><p>
            <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>programInterface</code></em>
            is not one of the accepted interface types.
        </p><p>
            <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>program</code></em>
            has not been linked successfully.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
            <a href="glGetProgramResourceName.xml"><span class="citerefentry"><span class="refentrytitle">glGetProgramResourceName</span></span></a>,
            <a href="glGetProgramResourceIndex.xml"><span class="citerefentry"><span class="refentrytitle">glGetProgramResourceIndex</span></span></a>,
            <a href="glGetGetProgramResource.xml"><span class="citerefentry"><span class="refentrytitle">glGetGetProgramResource</span></span></a>,
            <a href="glGetProgramResourceLocationIndex.xml"><span class="citerefentry"><span class="refentrytitle">glGetProgramResourceLocationIndex</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>© 2012 Khronos Group. 
            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>
