1GLBINDTEXTURE(3G) GLBINDTEXTURE(3G)
2
3
4
6 glBindTexture - bind a named texture to a texturing target
7
8
10 void glBindTexture( GLenum target,
11 GLuint texture )
12
13
15 target Specifies the target to which the texture is bound. Must be
16 either GL_TEXTURE_1D, GL_TEXTURE_2D, or GL_TEXTURE_3D.
17
18 texture Specifies the name of a texture.
19
21 glBindTexture lets you create or use a named texture. Calling
22 glBindTexture with
23 target set to GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D and texture
24 set to the name of the newtexture binds the texture name to the target.
25 When a texture is bound to a target, the previous binding for that tar‐
26 get is automatically broken.
27
28 Texture names are unsigned integers. The value zero is reserved to rep‐
29 resent the default texture for each texture target. Texture names and
30 the corresponding texture contents are local to the shared display-list
31 space (see glXCreateContext) of the current GL rendering context; two
32 rendering contexts share texture names only if they also share display
33 lists.
34
35 You may use glGenTextures to generate a set of new texture names.
36
37 When a texture is first bound, it assumes the dimensionality of its
38 target: A texture first bound to GL_TEXTURE_1D becomes one-dimen‐
39 sional, and a texture first bound to GL_TEXTURE_2D becomes two-dimen‐
40 sional, and a texture first bound to GL_TEXTURE_3D becomes a three-
41 dimensional texture. The state of a one-dimensional texture immediately
42 after it is first bound is equivalent to the state of the default
43 GL_TEXTURE_1D at GL initialization, and similarly for two-, and three-
44 dimensional textures.
45
46 While a texture is bound, GL operations on the target to which it is
47 bound affect the bound texture, and queries of the target to which it
48 is bound return state from the bound texture. If texture mapping of the
49 dimensionality of the target to which a texture is bound is active, the
50 bound texture is used. In effect, the texture targets become aliases
51 for the textures currently bound to them, and the texture name zero
52 refers to the default textures that were bound to them at initializa‐
53 tion.
54
55 A texture binding created with glBindTexture remains active until a
56 different texture is bound to the same target, or until the bound tex‐
57 ture is deleted with glDeleteTextures.
58
59 Once created, a named texture may be re-bound to the target of the
60 matching dimensionality as often as needed. It is usually much faster
61 to use glBindTexture to bind an existing named texture to one of the
62 texture targets than it is to reload the texture image using
63 glTexImage1D, glTexImage2D, or glTexImage3D. For additional control
64 over performance, use glPrioritizeTextures.
65
66 glBindTexture is included in display lists.
67
69 glBindTexture is available only if the GL version is 1.1 or greater.
70
72 GL_INVALID_ENUM is generated if target is not one of the allowable val‐
73 ues.
74
75 GL_INVALID_OPERATION is generated if texture has a dimensionality that
76 doesn't match that of target.
77
78 GL_INVALID_OPERATION is generated if glBindTexture is executed between
79 the execution of glBegin and the corresponding execution of glEnd.
80
82 glGet with argument GL_TEXTURE_BINDING_1D
83 glGet with argument GL_TEXTURE_BINDING_2D
84 glGet with argument GL_TEXTURE_BINDING_3D
85
87 glAreTexturesResident(3G), glDeleteTextures(3G), glGenTextures(3G),
88 glGet(3G),
89 glGetTexParameter(3G), glIsTexture(3G), glPrioritizeTextures(3G),
90 glTexImage1D(3G), glTexImage2D(3G), glTexParameter(3G)
91
92
93
94 GLBINDTEXTURE(3G)