Commit | Line | Data |
---|---|---|
7faf1d71 AW |
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_CUBE_MAP</constant>. | |
40 | </para> | |
41 | </listitem> | |
42 | </varlistentry> | |
43 | <varlistentry> | |
44 | <term><parameter>texture</parameter></term> | |
45 | <listitem> | |
46 | <para> | |
47 | Specifies the name of a texture. | |
48 | </para> | |
49 | </listitem> | |
50 | </varlistentry> | |
51 | </variablelist> | |
52 | </refsect1> | |
53 | <refsect1 id="description"><title>Description</title> | |
54 | <para> | |
55 | <function>glBindTexture</function> lets you create or use a named texture. Calling <function>glBindTexture</function> with | |
56 | <parameter>target</parameter> set to | |
57 | <constant>GL_TEXTURE_1D</constant>, <constant>GL_TEXTURE_2D</constant>, <constant>GL_TEXTURE_3D</constant> or | |
58 | <constant>GL_TEXTURE_CUBE_MAP</constant> and <parameter>texture</parameter> set to the name | |
59 | of the new texture binds the texture name to the target. | |
60 | When a texture is bound to a target, the previous binding for that | |
61 | target is automatically broken. | |
62 | </para> | |
63 | <para> | |
64 | Texture names are unsigned integers. The value zero is reserved to | |
65 | represent the default texture for each texture target. | |
66 | Texture names and the corresponding texture contents are local to | |
67 | the shared display-list space (see <citerefentry><refentrytitle>glXCreateContext</refentrytitle></citerefentry>) of the current | |
68 | GL rendering context; | |
69 | two rendering contexts share texture names only if they | |
70 | also share display lists. | |
71 | </para> | |
72 | <para> | |
73 | You may use <citerefentry><refentrytitle>glGenTextures</refentrytitle></citerefentry> to generate a set of new texture names. | |
74 | </para> | |
75 | <para> | |
76 | When a texture is first bound, it assumes the specified target: | |
77 | A texture first bound to <constant>GL_TEXTURE_1D</constant> becomes one-dimensional texture, a | |
78 | texture first bound to <constant>GL_TEXTURE_2D</constant> becomes two-dimensional texture, a | |
79 | texture first bound to <constant>GL_TEXTURE_3D</constant> becomes three-dimensional texture, and a | |
80 | texture first bound to <constant>GL_TEXTURE_CUBE_MAP</constant> | |
81 | becomes a cube-mapped texture. The state of a one-dimensional texture | |
82 | immediately after it is first bound is equivalent to the state of the | |
83 | default <constant>GL_TEXTURE_1D</constant> at GL initialization, and similarly for two- | |
84 | and three-dimensional textures and cube-mapped textures. | |
85 | </para> | |
86 | <para> | |
87 | While a texture is bound, GL operations on the target to which it is | |
88 | bound affect the bound texture, and queries of the target to which it | |
89 | is bound return state from the bound texture. If texture mapping is active | |
90 | on the target to which a texture is bound, the bound texture is used. | |
91 | In effect, the texture targets become aliases for the textures currently | |
92 | bound to them, and the texture name zero refers to the default textures | |
93 | that were bound to them at initialization. | |
94 | </para> | |
95 | <para> | |
96 | A texture binding created with <function>glBindTexture</function> remains active until a different | |
97 | texture is bound to the same target, or until the bound texture is | |
98 | deleted with <citerefentry><refentrytitle>glDeleteTextures</refentrytitle></citerefentry>. | |
99 | </para> | |
100 | <para> | |
101 | Once created, a named texture may be re-bound to its same original target as often as needed. | |
102 | It is usually much faster to use <function>glBindTexture</function> to bind an existing named | |
103 | texture to one of the texture targets than it is to reload the texture image | |
104 | using <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>, or <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>. | |
105 | For additional control over performance, use | |
106 | <citerefentry><refentrytitle>glPrioritizeTextures</refentrytitle></citerefentry>. | |
107 | </para> | |
108 | <para> | |
109 | <function>glBindTexture</function> is included in display lists. | |
110 | </para> | |
111 | </refsect1> | |
112 | <refsect1 id="notes"><title>Notes</title> | |
113 | <para> | |
114 | <function>glBindTexture</function> is available only if the GL version is 1.1 or greater. | |
115 | </para> | |
116 | <para> | |
117 | <constant>GL_TEXTURE_CUBE_MAP</constant> is available only if the GL version is 1.3 or greater. | |
118 | </para> | |
119 | </refsect1> | |
120 | <refsect1 id="errors"><title>Errors</title> | |
121 | <para> | |
122 | <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not one of the allowable | |
123 | values. | |
124 | </para> | |
125 | <para> | |
126 | <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>texture</parameter> was previously created with a target | |
127 | that doesn't match that of <parameter>target</parameter>. | |
128 | </para> | |
129 | <para> | |
130 | <constant>GL_INVALID_OPERATION</constant> is generated if <function>glBindTexture</function> is executed | |
131 | between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding | |
132 | execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>. | |
133 | </para> | |
134 | </refsect1> | |
135 | <refsect1 id="associatedgets"><title>Associated Gets</title> | |
136 | <para> | |
137 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_BINDING_1D</constant> | |
138 | </para> | |
139 | <para> | |
140 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_BINDING_2D</constant> | |
141 | </para> | |
142 | <para> | |
143 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_BINDING_3D</constant> | |
144 | </para> | |
145 | </refsect1> | |
146 | <refsect1 id="seealso"><title>See Also</title> | |
147 | <para> | |
148 | <citerefentry><refentrytitle>glAreTexturesResident</refentrytitle></citerefentry>, | |
149 | <citerefentry><refentrytitle>glDeleteTextures</refentrytitle></citerefentry>, | |
150 | <citerefentry><refentrytitle>glGenTextures</refentrytitle></citerefentry>, | |
151 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>, | |
152 | <citerefentry><refentrytitle>glGetTexParameter</refentrytitle></citerefentry>, | |
153 | <citerefentry><refentrytitle>glIsTexture</refentrytitle></citerefentry>, | |
154 | <citerefentry><refentrytitle>glPrioritizeTextures</refentrytitle></citerefentry>, | |
155 | <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>, | |
156 | <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>, | |
157 | <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry> | |
158 | </para> | |
159 | </refsect1> | |
160 | <refsect1 id="Copyright"><title>Copyright</title> | |
161 | <para> | |
162 | Copyright <trademark class="copyright"></trademark> 1991-2006 | |
163 | Silicon Graphics, Inc. This document is licensed under the SGI | |
164 | Free Software B License. For details, see | |
165 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. | |
166 | </para> | |
167 | </refsect1> | |
168 | </refentry> |