<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
              "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
<refentry id="glBindSamplers">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>2013</year>
                <holder>Khronos Group</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glBindSamplers</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glBindSamplers</refname>
        <refpurpose>bind one or more named sampler objects to a sequence of consecutive sampler units</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glBindSamplers</function></funcdef>
                <paramdef>GLuint <parameter>first</parameter></paramdef>
                <paramdef>GLsizei <parameter>count</parameter></paramdef>
                <paramdef>const GLuint *<parameter>samplers</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>first</parameter></term>
            <listitem>
                <para>
                    Specifies the first sampler unit to which a sampler object is to be bound.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>count</parameter></term>
            <listitem>
                <para>
                    Specifies the number of samplers to bind.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>samplers</parameter></term>
            <listitem>
                <para>
                    Specifies the address of an array of names of existing sampler objects.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glBindSamplers</function> binds samplers from an array of existing sampler objects to a specified
            number of consecutive sampler units. <parameter>count</parameter> specifies the number of sampler
            objects whose names are stored in the array <parameter>samplers</parameter>. That number
            of sampler names is read from the array and bound to the <parameter>count</parameter> consecutive
            sampler units starting from <parameter>first</parameter>.
        </para>
        <para>
            If the name zero appears in the <parameter>samplers</parameter> array, any existing binding
            to the sampler unit is reset. Any non-zero entry in <parameter>samplers</parameter> must be the
            name of an existing sampler object. When a non-zero entry in <parameter>samplers</parameter> is
            present, that sampler object is bound to the corresponding sampler unit.
            If <parameter>samplers</parameter> is <constant>NULL</constant> then it is as
            if an appropriately sized array containing only zeros had been specified.
        </para>
        <para>
            <function>glBindSamplers</function> is equivalent to the following pseudo code:
        </para>
<programlisting><![CDATA[    for (i = 0; i < count; i++) {
        if (samplers == NULL) {
            glBindSampler(first + i, 0);
        } else {
            glBindSampler(first + i, samplers[i]);
        }
    }]]></programlisting>
    <para>
        Each entry in <parameter>samplers</parameter> will be checked individually and if found
        to be invalid, the state for that sampler unit will not be changed and an error will be
        generated. However, the state for other sampler units referenced by the command will still
        be updated.
    </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            <function>glBindSamplers</function> is available only if the GL version is 4.4 or higher.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>first</parameter> + <parameter>count</parameter> is greater
            than the number of sampler units supported by the implementation.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if any value in <parameter>samplers</parameter> is
            not zero or the name of an existing sampler object.
        </para>
    </refsect1>
    <refsect1 id="associatedgets"><title>Associated Gets</title>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_SAMPLER_BINDING</constant>
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glGenSamplers</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glBindSampler</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDeleteSamplers</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glSamplerParameter</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glGetSamplerParameter</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glGenTextures</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glBindTexture</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDeleteTextures</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"></trademark> 2013 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.
            <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
        </para>
    </refsect1>
</refentry>
