2009-03-08 00:46:58 +00:00
<?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= "glBindTexture" >
<refmeta >
2014-03-28 19:06:55 +00:00
<refmetainfo >
<copyright >
<year > 1991-2006</year>
<holder > Silicon Graphics, Inc.</holder>
</copyright>
</refmetainfo>
2009-03-08 00:46:58 +00:00
<refentrytitle > glBindTexture</refentrytitle>
<manvolnum > 3G</manvolnum>
</refmeta>
<refnamediv >
<refname > glBindTexture</refname>
<refpurpose > bind a named texture to a texturing target</refpurpose>
</refnamediv>
<refsynopsisdiv > <title > C Specification</title>
<funcsynopsis >
<funcprototype >
<funcdef > void <function > glBindTexture</function> </funcdef>
<paramdef > GLenum <parameter > target</parameter> </paramdef>
<paramdef > GLuint <parameter > texture</parameter> </paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id= "parameters" > <title > Parameters</title>
<variablelist >
<varlistentry >
<term > <parameter > target</parameter> </term>
<listitem >
<para >
Specifies the target to which the texture is bound.
2014-03-28 19:06:55 +00:00
Must be either
2009-03-08 00:46:58 +00:00
<constant > GL_TEXTURE_1D</constant> ,
<constant > GL_TEXTURE_2D</constant> ,
2014-03-28 19:06:55 +00:00
<constant > GL_TEXTURE_3D</constant> , or
<constant > GL_TEXTURE_CUBE_MAP</constant> .
2009-03-08 00:46:58 +00:00
</para>
</listitem>
</varlistentry>
<varlistentry >
<term > <parameter > texture</parameter> </term>
<listitem >
<para >
Specifies the name of a texture.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id= "description" > <title > Description</title>
<para >
<function > glBindTexture</function> lets you create or use a named texture. Calling <function > glBindTexture</function> with
<parameter > target</parameter> set to
2014-03-28 19:06:55 +00:00
<constant > GL_TEXTURE_1D</constant> , <constant > GL_TEXTURE_2D</constant> , <constant > GL_TEXTURE_3D</constant> or
<constant > GL_TEXTURE_CUBE_MAP</constant> and <parameter > texture</parameter> set to the name
of the new texture binds the texture name to the target.
When a texture is bound to a target, the previous binding for that
target is automatically broken.
2009-03-08 00:46:58 +00:00
</para>
<para >
Texture names are unsigned integers. The value zero is reserved to
represent the default texture for each texture target.
Texture names and the corresponding texture contents are local to
2014-03-28 19:06:55 +00:00
the shared display-list space (see <citerefentry > <refentrytitle > glXCreateContext</refentrytitle> </citerefentry> ) of the current
GL rendering context;
2009-03-08 00:46:58 +00:00
two rendering contexts share texture names only if they
2014-03-28 19:06:55 +00:00
also share display lists.
2009-03-08 00:46:58 +00:00
</para>
<para >
2014-03-28 19:06:55 +00:00
You may use <citerefentry > <refentrytitle > glGenTextures</refentrytitle> </citerefentry> to generate a set of new texture names.
2009-03-08 00:46:58 +00:00
</para>
<para >
When a texture is first bound, it assumes the specified target:
A texture first bound to <constant > GL_TEXTURE_1D</constant> becomes one-dimensional texture, a
texture first bound to <constant > GL_TEXTURE_2D</constant> becomes two-dimensional texture, a
2014-03-28 19:06:55 +00:00
texture first bound to <constant > GL_TEXTURE_3D</constant> becomes three-dimensional texture, and a
texture first bound to <constant > GL_TEXTURE_CUBE_MAP</constant>
becomes a cube-mapped texture. The state of a one-dimensional texture
immediately after it is first bound is equivalent to the state of the
default <constant > GL_TEXTURE_1D</constant> at GL initialization, and similarly for two-
and three-dimensional textures and cube-mapped textures.
2009-03-08 00:46:58 +00:00
</para>
<para >
While a texture is bound, GL operations on the target to which it is
bound affect the bound texture, and queries of the target to which it
2014-03-28 19:06:55 +00:00
is bound return state from the bound texture. If texture mapping is active
on the target to which a texture is bound, the bound texture is used.
2009-03-08 00:46:58 +00:00
In effect, the texture targets become aliases for the textures currently
bound to them, and the texture name zero refers to the default textures
that were bound to them at initialization.
</para>
<para >
A texture binding created with <function > glBindTexture</function> remains active until a different
texture is bound to the same target, or until the bound texture is
deleted with <citerefentry > <refentrytitle > glDeleteTextures</refentrytitle> </citerefentry> .
</para>
<para >
Once created, a named texture may be re-bound to its same original target as often as needed.
It is usually much faster to use <function > glBindTexture</function> to bind an existing named
texture to one of the texture targets than it is to reload the texture image
2014-03-28 19:06:55 +00:00
using <citerefentry > <refentrytitle > glTexImage1D</refentrytitle> </citerefentry> , <citerefentry > <refentrytitle > glTexImage2D</refentrytitle> </citerefentry> , or <citerefentry > <refentrytitle > glTexImage3D</refentrytitle> </citerefentry> .
For additional control over performance, use
<citerefentry > <refentrytitle > glPrioritizeTextures</refentrytitle> </citerefentry> .
</para>
<para >
<function > glBindTexture</function> is included in display lists.
2009-03-08 00:46:58 +00:00
</para>
</refsect1>
<refsect1 id= "notes" > <title > Notes</title>
<para >
2014-03-28 19:06:55 +00:00
<function > glBindTexture</function> is available only if the GL version is 1.1 or greater.
</para>
<para >
<constant > GL_TEXTURE_CUBE_MAP</constant> is available only if the GL version is 1.3 or greater.
2009-03-08 00:46:58 +00:00
</para>
</refsect1>
<refsect1 id= "errors" > <title > Errors</title>
<para >
<constant > GL_INVALID_ENUM</constant> is generated if <parameter > target</parameter> is not one of the allowable
values.
</para>
<para >
2010-11-21 14:34:29 +00:00
<constant > GL_INVALID_OPERATION</constant> is generated if <parameter > texture</parameter> was previously created with a target
that doesn't match that of <parameter > target</parameter> .
2009-03-08 00:46:58 +00:00
</para>
2014-03-28 19:06:55 +00:00
<para >
<constant > GL_INVALID_OPERATION</constant> is generated if <function > glBindTexture</function> is executed
between the execution of <citerefentry > <refentrytitle > glBegin</refentrytitle> </citerefentry> and the corresponding
execution of <citerefentry > <refentrytitle > glEnd</refentrytitle> </citerefentry> .
</para>
2009-03-08 00:46:58 +00:00
</refsect1>
<refsect1 id= "associatedgets" > <title > Associated Gets</title>
<para >
2014-03-28 19:06:55 +00:00
<citerefentry > <refentrytitle > glGet</refentrytitle> </citerefentry> with argument <constant > GL_TEXTURE_BINDING_1D</constant>
</para>
<para >
<citerefentry > <refentrytitle > glGet</refentrytitle> </citerefentry> with argument <constant > GL_TEXTURE_BINDING_2D</constant>
</para>
<para >
<citerefentry > <refentrytitle > glGet</refentrytitle> </citerefentry> with argument <constant > GL_TEXTURE_BINDING_3D</constant>
2009-03-08 00:46:58 +00:00
</para>
</refsect1>
<refsect1 id= "seealso" > <title > See Also</title>
<para >
2014-03-28 19:06:55 +00:00
<citerefentry > <refentrytitle > glAreTexturesResident</refentrytitle> </citerefentry> ,
2009-03-08 00:46:58 +00:00
<citerefentry > <refentrytitle > glDeleteTextures</refentrytitle> </citerefentry> ,
<citerefentry > <refentrytitle > glGenTextures</refentrytitle> </citerefentry> ,
<citerefentry > <refentrytitle > glGet</refentrytitle> </citerefentry> ,
<citerefentry > <refentrytitle > glGetTexParameter</refentrytitle> </citerefentry> ,
<citerefentry > <refentrytitle > glIsTexture</refentrytitle> </citerefentry> ,
2014-03-28 19:06:55 +00:00
<citerefentry > <refentrytitle > glPrioritizeTextures</refentrytitle> </citerefentry> ,
2009-03-08 00:46:58 +00:00
<citerefentry > <refentrytitle > glTexImage1D</refentrytitle> </citerefentry> ,
<citerefentry > <refentrytitle > glTexImage2D</refentrytitle> </citerefentry> ,
<citerefentry > <refentrytitle > glTexParameter</refentrytitle> </citerefentry>
</para>
</refsect1>
<refsect1 id= "Copyright" > <title > Copyright</title>
<para >
2014-03-28 19:06:55 +00:00
Copyright <trademark class= "copyright" > </trademark> 1991-2006
Silicon Graphics, Inc. This document is licensed under the SGI
2009-03-08 00:46:58 +00:00
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>