<?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="glPrioritizeTextures">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glPrioritizeTextures</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glPrioritizeTextures</refname>
        <refpurpose>set texture residence priority</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glPrioritizeTextures</function></funcdef>
                <paramdef>GLsizei <parameter>n</parameter></paramdef>
                <paramdef>const GLuint * <parameter>textures</parameter></paramdef>
                <paramdef>const GLclampf * <parameter>priorities</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>n</parameter></term>
            <listitem>
                <para>
                    Specifies the number of textures to be prioritized.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>textures</parameter></term>
            <listitem>
                <para>
                    Specifies an array containing the names of the textures to be prioritized.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>priorities</parameter></term>
            <listitem>
                <para>
                    Specifies an array containing the texture priorities.
                    A priority given in an element of <parameter>priorities</parameter> applies to the texture
                    named by the corresponding element of <parameter>textures</parameter>.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glPrioritizeTextures</function> assigns the <parameter>n</parameter> texture priorities given in <parameter>priorities</parameter> to the
            <parameter>n</parameter> textures named in <parameter>textures</parameter>.
        </para>
        <para>
            The GL establishes
            a ``working set'' of textures that are resident in texture memory.
            These textures may be bound to a texture target much more efficiently
            than textures that are not resident.
            By specifying a priority for each texture,
            <function>glPrioritizeTextures</function> allows applications to guide the GL implementation in determining
            which textures should be resident.
        </para>
        <para>
            The priorities given in <parameter>priorities</parameter> are clamped to the range 
            <inlineequation><mml:math>
                <!-- eqn: [0,1]:-->
                <mml:mfenced open="[" close="]">
                    <mml:mn>0</mml:mn>
                    <mml:mn>1</mml:mn>
                </mml:mfenced>
            </mml:math></inlineequation>
            before they are assigned.
            0 indicates the lowest priority; textures with priority 0
            are least likely to be resident.
            1 indicates the highest priority; textures with priority 1
            are most likely to be resident.
            However, textures are not guaranteed to be resident until they are used.
        </para>
        <para>
            <function>glPrioritizeTextures</function> silently ignores attempts to prioritize texture 0 or any texture
            name that does not correspond to an existing texture.
        </para>
        <para>
            <function>glPrioritizeTextures</function> does not require that any of the textures named by <parameter>textures</parameter>
            be bound to a texture target.
            <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry> may also be used to set a texture's priority,
            but only if the texture is currently bound.
            This is the only way to set the priority of a default texture.
        </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            <function>glPrioritizeTextures</function> is available only if the GL version is 1.1 or greater.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_VALUE</constant> is generated if <parameter>n</parameter> is negative.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <function>glPrioritizeTextures</function> is executed
            between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding
            execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
        </para>
    </refsect1>
    <refsect1 id="associatedgets"><title>Associated Gets</title>
        <para>
            <citerefentry><refentrytitle>glGetTexParameter</refentrytitle></citerefentry> with parameter name <constant>GL_TEXTURE_PRIORITY</constant>
            retrieves the priority of a currently bound texture.
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glAreTexturesResident</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glBindTexture</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glCopyTexImage1D</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glCopyTexImage2D</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"></trademark> 1991-2006
            Silicon Graphics, Inc. This document is licensed under the SGI
            Free Software B License. For details, see
            <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
        </para>
    </refsect1>
</refentry>
