<!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="glUniformBlockBinding">
    <info>
        <copyright>
            <year>2010-2014</year>
            <holder>Khronos Group</holder>
        </copyright>
    </info>
    <refmeta>
        <refentrytitle>glUniformBlockBinding</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glUniformBlockBinding</refname>
        <refpurpose>assign a binding point to an active uniform block</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glUniformBlockBinding</function></funcdef>
                <paramdef>GLuint <parameter>program</parameter></paramdef>
                <paramdef>GLuint <parameter>uniformBlockIndex</parameter></paramdef>
                <paramdef>GLuint <parameter>uniformBlockBinding</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 xml:id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>program</parameter></term>
            <listitem>
                <para>
                    The name of a program object containing the active uniform block whose binding to assign.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>uniformBlockIndex</parameter></term>
            <listitem>
                <para>
                    The index of the active uniform block within <parameter>program</parameter> whose binding to assign.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>uniformBlockBinding</parameter></term>
            <listitem>
                <para>
                    Specifies the binding point to which to bind the uniform block with index <parameter>uniformBlockIndex</parameter> within <parameter>program</parameter>.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 xml:id="description"><title>Description</title>
        <para>
            Binding points for active uniform blocks are assigned using <function>glUniformBlockBinding</function>. Each of a program's active uniform
            blocks has a corresponding uniform buffer binding point. <parameter>program</parameter> is the name of a program object for which the command
            <citerefentry><refentrytitle>glLinkProgram</refentrytitle></citerefentry> has been issued in the past.
        </para>
        <para>
            If successful, <function>glUniformBlockBinding</function> specifies that <parameter>program</parameter> will use the data store of the
            buffer object bound to the binding point <parameter>uniformBlockBinding</parameter> to extract the values of the uniforms in the
            uniform block identified by <parameter>uniformBlockIndex</parameter>.
        </para>
        <para>
            When a program object is linked or re-linked, the uniform buffer object binding point assigned to each of its active uniform blocks is reset to zero.
        </para>
    </refsect1>
    <refsect1 xml:id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_VALUE</constant> is generated if <parameter>uniformBlockIndex</parameter> is not an active uniform block index of <parameter>program</parameter>.
        </para>
        <para>
            <constant>GL_INVALID_VALUE</constant> is generated if <parameter>uniformBlockBinding</parameter> is greater than or equal to the value of <constant>GL_MAX_UNIFORM_BUFFER_BINDINGS</constant>.
        </para>
        <para>
            <constant>GL_INVALID_VALUE</constant> is generated if <parameter>program</parameter> is not the name of a program object generated by the GL.
        </para>
    </refsect1>
    <refsect1 xml:id="associatedgets"><title>Associated Gets</title>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_MAX_UNIFORM_BUFFER_BINDINGS</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGetActiveUniformBlockiv</refentrytitle></citerefentry> with argument <constant>GL_UNIFORM_BLOCK_BINDING</constant>
        </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>glUniformBlockBinding</entry>
                        <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apiversion.xml" xpointer="xpointer(/*/*[@role='es30']/*)"/>
                    </row>
                </tbody>
            </tgroup>
        </informaltable>
    </refsect1>
    <refsect1 xml:id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glLinkProgram</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glBindBufferBase</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glBindBufferRange</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glGetActiveUniformBlockiv</refentrytitle></citerefentry>
        </para>
    </refsect1>

    <refsect1 xml:id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"/> 2010-2014 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.
            <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://opencontent.org/openpub/">http://opencontent.org/openpub/</link>.
        </para>
    </refsect1>
</refentry>
