1GLBINDTEXTURE(3G) OpenGL Manual GLBINDTEXTURE(3G)
2
3
4
6 glBindTexture - bind a named texture to a texturing target
7
9 void glBindTexture(GLenum target, GLuint texture);
10
12 target
13 Specifies the target to which the texture is bound. Must be one of
14 GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_1D_ARRAY,
15 GL_TEXTURE_2D_ARRAY, GL_TEXTURE_RECTANGLE, GL_TEXTURE_CUBE_MAP,
16 GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_BUFFER,
17 GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY.
18
19 texture
20 Specifies the name of a texture.
21
23 glBindTexture lets you create or use a named texture. Calling
24 glBindTexture with target set to GL_TEXTURE_1D, GL_TEXTURE_2D,
25 GL_TEXTURE_3D, GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D_ARRAY,
26 GL_TEXTURE_RECTANGLE, GL_TEXTURE_CUBE_MAP, GL_TEXTURE_CUBE_MAP_ARRAY,
27 GL_TEXTURE_BUFFER, GL_TEXTURE_2D_MULTISAMPLE or
28 GL_TEXTURE_2D_MULTISAMPLE_ARRAY and texture set to the name of the new
29 texture binds the texture name to the target. When a texture is bound
30 to a target, the previous binding for that target is automatically
31 broken.
32
33 Texture names are unsigned integers. The value zero is reserved to
34 represent the default texture for each texture target. Texture names
35 and the corresponding texture contents are local to the shared object
36 space of the current GL rendering context; two rendering contexts share
37 texture names only if they explicitly enable sharing between contexts
38 through the appropriate GL windows interfaces functions.
39
40 You must use glGenTextures() to generate a set of new texture names.
41
42 When a texture is first bound, it assumes the specified target: A
43 texture first bound to GL_TEXTURE_1D becomes one-dimensional texture, a
44 texture first bound to GL_TEXTURE_2D becomes two-dimensional texture, a
45 texture first bound to GL_TEXTURE_3D becomes three-dimensional texture,
46 a texture first bound to GL_TEXTURE_1D_ARRAY becomes one-dimensional
47 array texture, a texture first bound to GL_TEXTURE_2D_ARRAY becomes
48 two-dimensional arary texture, a texture first bound to
49 GL_TEXTURE_RECTANGLE becomes rectangle texture, a texture first bound
50 to GL_TEXTURE_CUBE_MAP becomes a cube-mapped texture, a texture first
51 bound to GL_TEXTURE_CUBE_MAP_ARRAY becomes a cube-mapped array texture,
52 a texture first bound to GL_TEXTURE_BUFFER becomes a buffer texture, a
53 texture first bound to GL_TEXTURE_2D_MULTISAMPLE becomes a
54 two-dimensional multisampled texture, and a texture first bound to
55 GL_TEXTURE_2D_MULTISAMPLE_ARRAY becomes a two-dimensional multisampled
56 array texture. The state of a one-dimensional texture immediately after
57 it is first bound is equivalent to the state of the default
58 GL_TEXTURE_1D at GL initialization, and similarly for the other texture
59 types.
60
61 While a texture is bound, GL operations on the target to which it is
62 bound affect the bound texture, and queries of the target to which it
63 is bound return state from the bound texture. In effect, the texture
64 targets become aliases for the textures currently bound to them, and
65 the texture name zero refers to the default textures that were bound to
66 them at initialization.
67
68 A texture binding created with glBindTexture remains active until a
69 different texture is bound to the same target, or until the bound
70 texture is deleted with glDeleteTextures().
71
72 Once created, a named texture may be re-bound to its same original
73 target as often as needed. It is usually much faster to use
74 glBindTexture to bind an existing named texture to one of the texture
75 targets than it is to reload the texture image using glTexImage1D(),
76 glTexImage2D(), glTexImage3D() or another similar function.
77
79 The GL_TEXTURE_2D_MULTISAMPLE and GL_TEXTURE_2D_MULTISAMPLE_ARRAY
80 targets are available only if the GL version is 3.2 or higher.
81
83 GL_INVALID_ENUM is generated if target is not one of the allowable
84 values.
85
86 GL_INVALID_VALUE is generated if target is not a name returned from a
87 previous call to glGenTextures().
88
89 GL_INVALID_OPERATION is generated if texture was previously created
90 with a target that doesn't match that of target.
91
93 glGet() with argument GL_TEXTURE_BINDING_1D, GL_TEXTURE_BINDING_2D,
94 GL_TEXTURE_BINDING_3D, GL_TEXTURE_BINDING_1D_ARRAY,
95 GL_TEXTURE_BINDING_2D_ARRAY, GL_TEXTURE_BINDING_RECTANGLE,
96 GL_TEXTURE_BINDING_BUFFER, GL_TEXTURE_BINDING_CUBE_MAP,
97 GL_TEXTURE_BINDING_CUBE_MAP, GL_TEXTURE_BINDING_CUBE_MAP_ARRAY,
98 GL_TEXTURE_BINDING_2D_MULTISAMPLE, or
99 GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY.
100
102 glDeleteTextures(), glGenTextures(), glGet(), glGetTexParameter(),
103 glIsTexture(), glTexImage1D(), glTexImage2D(),
104 glTexImage2DMultisample(), glTexImage3D(), glTexImage3DMultisample(),
105 glTexBuffer(), glTexParameter()
106
108 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
109 under the SGI Free Software B License. For details, see
110 http://oss.sgi.com/projects/FreeB/.
111
113 opengl.org
114
115
116
117opengl.org 06/10/2014 GLBINDTEXTURE(3G)