Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
2 | <!-- saved from url=(0013)about:internet --> | |
3 | <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>glBindTexture</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glBindTexture"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glBindTexture — bind a named texture to a texturing target</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glBindTexture</b>(</code></td><td>GLenum </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLuint </td><td><var class="pdparam">texture</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>target</code></em></span></dt><dd><p> | |
4 | Specifies the target to which the texture is bound. | |
5 | Must be either | |
6 | <code class="constant">GL_TEXTURE_1D</code>, | |
7 | <code class="constant">GL_TEXTURE_2D</code>, | |
8 | <code class="constant">GL_TEXTURE_3D</code>, or | |
9 | <code class="constant">GL_TEXTURE_CUBE_MAP</code>. | |
10 | </p></dd><dt><span class="term"><em class="parameter"><code>texture</code></em></span></dt><dd><p> | |
11 | Specifies the name of a texture. | |
12 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
13 | <code class="function">glBindTexture</code> lets you create or use a named texture. Calling <code class="function">glBindTexture</code> with | |
14 | <em class="parameter"><code>target</code></em> set to | |
15 | <code class="constant">GL_TEXTURE_1D</code>, <code class="constant">GL_TEXTURE_2D</code>, <code class="constant">GL_TEXTURE_3D</code> or | |
16 | <code class="constant">GL_TEXTURE_CUBE_MAP</code> and <em class="parameter"><code>texture</code></em> set to the name | |
17 | of the new texture binds the texture name to the target. | |
18 | When a texture is bound to a target, the previous binding for that | |
19 | target is automatically broken. | |
20 | </p><p> | |
21 | Texture names are unsigned integers. The value zero is reserved to | |
22 | represent the default texture for each texture target. | |
23 | Texture names and the corresponding texture contents are local to | |
24 | the shared display-list space (see <a class="citerefentry" href="glXCreateContext.xml"><span class="citerefentry"><span class="refentrytitle">glXCreateContext</span></span></a>) of the current | |
25 | GL rendering context; | |
26 | two rendering contexts share texture names only if they | |
27 | also share display lists. | |
28 | </p><p> | |
29 | You may use <a class="citerefentry" href="glGenTextures.xml"><span class="citerefentry"><span class="refentrytitle">glGenTextures</span></span></a> to generate a set of new texture names. | |
30 | </p><p> | |
31 | When a texture is first bound, it assumes the specified target: | |
32 | A texture first bound to <code class="constant">GL_TEXTURE_1D</code> becomes one-dimensional texture, a | |
33 | texture first bound to <code class="constant">GL_TEXTURE_2D</code> becomes two-dimensional texture, a | |
34 | texture first bound to <code class="constant">GL_TEXTURE_3D</code> becomes three-dimensional texture, and a | |
35 | texture first bound to <code class="constant">GL_TEXTURE_CUBE_MAP</code> | |
36 | becomes a cube-mapped texture. The state of a one-dimensional texture | |
37 | immediately after it is first bound is equivalent to the state of the | |
38 | default <code class="constant">GL_TEXTURE_1D</code> at GL initialization, and similarly for two- | |
39 | and three-dimensional textures and cube-mapped textures. | |
40 | </p><p> | |
41 | While a texture is bound, GL operations on the target to which it is | |
42 | bound affect the bound texture, and queries of the target to which it | |
43 | is bound return state from the bound texture. If texture mapping is active | |
44 | on the target to which a texture is bound, the bound texture is used. | |
45 | In effect, the texture targets become aliases for the textures currently | |
46 | bound to them, and the texture name zero refers to the default textures | |
47 | that were bound to them at initialization. | |
48 | </p><p> | |
49 | A texture binding created with <code class="function">glBindTexture</code> remains active until a different | |
50 | texture is bound to the same target, or until the bound texture is | |
51 | deleted with <a class="citerefentry" href="glDeleteTextures.xml"><span class="citerefentry"><span class="refentrytitle">glDeleteTextures</span></span></a>. | |
52 | </p><p> | |
53 | Once created, a named texture may be re-bound to its same original target as often as needed. | |
54 | It is usually much faster to use <code class="function">glBindTexture</code> to bind an existing named | |
55 | texture to one of the texture targets than it is to reload the texture image | |
56 | using <a class="citerefentry" href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>, <a class="citerefentry" href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>, or <a class="citerefentry" href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a>. | |
57 | For additional control over performance, use | |
58 | <a class="citerefentry" href="glPrioritizeTextures.xml"><span class="citerefentry"><span class="refentrytitle">glPrioritizeTextures</span></span></a>. | |
59 | </p><p> | |
60 | <code class="function">glBindTexture</code> is included in display lists. | |
61 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
62 | <code class="function">glBindTexture</code> is available only if the GL version is 1.1 or greater. | |
63 | </p><p> | |
64 | <code class="constant">GL_TEXTURE_CUBE_MAP</code> is available only if the GL version is 1.3 or greater. | |
65 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
66 | <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>target</code></em> is not one of the allowable | |
67 | values. | |
68 | </p><p> | |
69 | <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>texture</code></em> was previously created with a target | |
70 | that doesn't match that of <em class="parameter"><code>target</code></em>. | |
71 | </p><p> | |
72 | <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glBindTexture</code> is executed | |
73 | between the execution of <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> and the corresponding | |
74 | execution of <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>. | |
75 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p> | |
76 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_TEXTURE_BINDING_1D</code> | |
77 | </p><p> | |
78 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_TEXTURE_BINDING_2D</code> | |
79 | </p><p> | |
80 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_TEXTURE_BINDING_3D</code> | |
81 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
82 | <a class="citerefentry" href="glAreTexturesResident.xml"><span class="citerefentry"><span class="refentrytitle">glAreTexturesResident</span></span></a>, | |
83 | <a class="citerefentry" href="glDeleteTextures.xml"><span class="citerefentry"><span class="refentrytitle">glDeleteTextures</span></span></a>, | |
84 | <a class="citerefentry" href="glGenTextures.xml"><span class="citerefentry"><span class="refentrytitle">glGenTextures</span></span></a>, | |
85 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a>, | |
86 | <a class="citerefentry" href="glGetTexParameter.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexParameter</span></span></a>, | |
87 | <a class="citerefentry" href="glIsTexture.xml"><span class="citerefentry"><span class="refentrytitle">glIsTexture</span></span></a>, | |
88 | <a class="citerefentry" href="glPrioritizeTextures.xml"><span class="citerefentry"><span class="refentrytitle">glPrioritizeTextures</span></span></a>, | |
89 | <a class="citerefentry" href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>, | |
90 | <a class="citerefentry" href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>, | |
91 | <a class="citerefentry" href="glTexParameter.xml"><span class="citerefentry"><span class="refentrytitle">glTexParameter</span></span></a> | |
92 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
93 | Copyright <span class="trademark"></span>© 1991-2006 | |
94 | Silicon Graphics, Inc. This document is licensed under the SGI | |
95 | Free Software B License. For details, see | |
96 | <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
97 | </p></div></div></body></html> |