rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man3 / glBindTexture.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id="glBindTexture">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>1991-2006</year>
9 <holder>Silicon Graphics, Inc.</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>glBindTexture</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>glBindTexture</refname>
17 <refpurpose>bind a named texture to a texturing target</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>C Specification</title>
20 <funcsynopsis>
21 <funcprototype>
22 <funcdef>void <function>glBindTexture</function></funcdef>
23 <paramdef>GLenum <parameter>target</parameter></paramdef>
24 <paramdef>GLuint <parameter>texture</parameter></paramdef>
25 </funcprototype>
26 </funcsynopsis>
27 </refsynopsisdiv>
28 <refsect1 id="parameters"><title>Parameters</title>
29 <variablelist>
30 <varlistentry>
31 <term><parameter>target</parameter></term>
32 <listitem>
33 <para>
34 Specifies the target to which the texture is bound.
35 Must be either
36 <constant>GL_TEXTURE_1D</constant>,
37 <constant>GL_TEXTURE_2D</constant>,
38 <constant>GL_TEXTURE_3D</constant>, or
39 <constant>GL_TEXTURE_1D_ARRAY</constant>,
40 <constant>GL_TEXTURE_2D_ARRAY</constant>,
41 <constant>GL_TEXTURE_RECTANGLE</constant>,
42 <constant>GL_TEXTURE_CUBE_MAP</constant>,
43 <constant>GL_TEXTURE_BUFFER</constant>,
44 <constant>GL_TEXTURE_2D_MULTISAMPLE</constant> or
45 <constant>GL_TEXTURE_2D_MULTISAMPLE_ARRAY</constant>.
46 </para>
47 </listitem>
48 </varlistentry>
49 <varlistentry>
50 <term><parameter>texture</parameter></term>
51 <listitem>
52 <para>
53 Specifies the name of a texture.
54 </para>
55 </listitem>
56 </varlistentry>
57 </variablelist>
58 </refsect1>
59 <refsect1 id="description"><title>Description</title>
60 <para>
61 <function>glBindTexture</function> lets you create or use a named texture. Calling <function>glBindTexture</function> with
62 <parameter>target</parameter> set to
63 <constant>GL_TEXTURE_1D</constant>,
64 <constant>GL_TEXTURE_2D</constant>,
65 <constant>GL_TEXTURE_3D</constant>, or
66 <constant>GL_TEXTURE_1D_ARRAY</constant>,
67 <constant>GL_TEXTURE_2D_ARRAY</constant>,
68 <constant>GL_TEXTURE_RECTANGLE</constant>,
69 <constant>GL_TEXTURE_CUBE_MAP</constant>,
70 <constant>GL_TEXTURE_BUFFER</constant>,
71 <constant>GL_TEXTURE_2D_MULTISAMPLE</constant> or
72 <constant>GL_TEXTURE_2D_MULTISAMPLE_ARRAY</constant>
73 and <parameter>texture</parameter> set to the name of the new texture binds the texture name to the target.
74 When a texture is bound to a target, the previous binding for that target is automatically broken.
75 </para>
76 <para>
77 Texture names are unsigned integers. The value zero is reserved to
78 represent the default texture for each texture target.
79 Texture names and the corresponding texture contents are local to
80 the shared object space of the current GL rendering context;
81 two rendering contexts share texture names only if they
82 explicitly enable sharing between contexts through the appropriate GL windows interfaces functions.
83 </para>
84 <para>
85 You must use <citerefentry><refentrytitle>glGenTextures</refentrytitle></citerefentry> to generate a set of new texture names.
86 </para>
87 <para>
88 When a texture is first bound, it assumes the specified target:
89 A texture first bound to <constant>GL_TEXTURE_1D</constant> becomes one-dimensional texture, a
90 texture first bound to <constant>GL_TEXTURE_2D</constant> becomes two-dimensional texture, a
91 texture first bound to <constant>GL_TEXTURE_3D</constant> becomes three-dimensional texture, a
92 texture first bound to <constant>GL_TEXTURE_1D_ARRAY</constant> becomes one-dimensional array texture, a
93 texture first bound to <constant>GL_TEXTURE_2D_ARRAY</constant> becomes two-dimensional arary texture, a
94 texture first bound to <constant>GL_TEXTURE_RECTANGLE</constant> becomes rectangle texture, a,
95 texture first bound to <constant>GL_TEXTURE_CUBE_MAP</constant> becomes a cube-mapped texture, a
96 texture first bound to <constant>GL_TEXTURE_BUFFER</constant> becomes a buffer texture, a
97 texture first bound to <constant>GL_TEXTURE_2D_MULTISAMPLE</constant> becomes a two-dimensional multisampled texture, and a
98 texture first bound to <constant>GL_TEXTURE_2D_MULTISAMPLE_ARRAY</constant> becomes a two-dimensional multisampled array texture.
99 The state of a one-dimensional texture immediately after it is first bound is equivalent to the state of the
100 default <constant>GL_TEXTURE_1D</constant> at GL initialization, and similarly for the other texture types.
101 </para>
102 <para>
103 While a texture is bound, GL operations on the target to which it is
104 bound affect the bound texture, and queries of the target to which it
105 is bound return state from the bound texture.
106 In effect, the texture targets become aliases for the textures currently
107 bound to them, and the texture name zero refers to the default textures
108 that were bound to them at initialization.
109 </para>
110 <para>
111 A texture binding created with <function>glBindTexture</function> remains active until a different
112 texture is bound to the same target, or until the bound texture is
113 deleted with <citerefentry><refentrytitle>glDeleteTextures</refentrytitle></citerefentry>.
114 </para>
115 <para>
116 Once created, a named texture may be re-bound to its same original target as often as needed.
117 It is usually much faster to use <function>glBindTexture</function> to bind an existing named
118 texture to one of the texture targets than it is to reload the texture image
119 using <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>,
120 <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry> or another similar function.
121 </para>
122 </refsect1>
123 <refsect1 id="notes"><title>Notes</title>
124 <para>
125 The <constant>GL_TEXTURE_2D_MULTISAMPLE</constant> and <constant>GL_TEXTURE_2D_MULTISAMPLE_ARRAY</constant> targets are available
126 only if the GL version is 3.2 or higher.
127 </para>
128 </refsect1>
129 <refsect1 id="errors"><title>Errors</title>
130 <para>
131 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not one of the allowable
132 values.
133 </para>
134 <para>
135 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>target</parameter> is not a name returned from
136 a previous call to <citerefentry><refentrytitle>glGenTextures</refentrytitle></citerefentry>.
137 </para>
138 <para>
139 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>texture</parameter> was previously created with a target
140 that doesn't match that of <parameter>target</parameter>.
141 </para>
142 </refsect1>
143 <refsect1 id="associatedgets"><title>Associated Gets</title>
144 <para>
145 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_BINDING_1D</constant>,
146 <constant>GL_TEXTURE_BINDING_2D</constant>, <constant>GL_TEXTURE_BINDING_3D</constant>, <constant>GL_TEXTURE_BINDING_1D_ARRAY</constant>,
147 <constant>GL_TEXTURE_BINDING_2D_ARRAY</constant>, <constant>GL_TEXTURE_BINDING_RECTANGLE</constant>, <constant>GL_TEXTURE_BINDING_2D_MULTISAMPLE</constant>,
148 or <constant>GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY</constant>.
149 </para>
150 </refsect1>
151 <refsect1 id="seealso"><title>See Also</title>
152 <para>
153 <citerefentry><refentrytitle>glDeleteTextures</refentrytitle></citerefentry>,
154 <citerefentry><refentrytitle>glGenTextures</refentrytitle></citerefentry>,
155 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>,
156 <citerefentry><refentrytitle>glGetTexParameter</refentrytitle></citerefentry>,
157 <citerefentry><refentrytitle>glIsTexture</refentrytitle></citerefentry>,
158 <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>,
159 <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>,
160 <citerefentry><refentrytitle>glTexImage2DMultisample</refentrytitle></citerefentry>,
161 <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>,
162 <citerefentry><refentrytitle>glTexImage3DMultisample</refentrytitle></citerefentry>,
163 <citerefentry><refentrytitle>glTexBuffer</refentrytitle></citerefentry>,
164 <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry>
165 </para>
166 </refsect1>
167 <refsect1 id="Copyright"><title>Copyright</title>
168 <para>
169 Copyright <trademark class="copyright"></trademark> 1991-2006
170 Silicon Graphics, Inc. This document is licensed under the SGI
171 Free Software B License. For details, see
172 <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
173 </para>
174 </refsect1>
175 </refentry>