- bind a named texture to a texturing target
C SPECIFICATION
PARAMETERS
_param1 Specifies the target to which the texture is
bound. Must be either GL_TEXTURE_1D,
GL_TEXTURE_2D, or GL_TEXTURE_3D.
_param2 Specifies the name of a texture.
DESCRIPTION
glBindTexture lets you create or use a named texture.
Calling glBindTexture with
_param1 set to GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D
and _param2 set to the name of the newtexture binds the
texture name to the target. When a texture is bound to a
target, the previous binding for that target is automati-
cally broken.
Texture names are unsigned integers. The value zero is
reserved to represent the default texture for each texture
target. Texture names and the corresponding texture con-
tents are local to the shared display-list space (see
glXCreateContext) of the current GL rendering context; two
rendering contexts share texture names only if they also
share display lists.
You may use glGenTextures to generate a set of new texture
names.
When a texture is first bound, it assumes the dimensional-
ity of its target: A texture first bound to GL_TEXTURE_1D
becomes one-dimensional, and a texture first bound to
GL_TEXTURE_2D becomes two-dimensional, and a texture first
bound to GL_TEXTURE_3D becomes a three-dimensional tex-
ture. The state of a one-dimensional texture immediately
after it is first bound is equivalent to the state of the
default GL_TEXTURE_1D at GL initialization, and similarly
for two-, and three-dimensional textures.
While a texture is bound, GL operations on the target to
which it is bound affect the bound texture, and queries of
the target to which it is bound return state from the
bound texture. If texture mapping of the dimensionality of
the target to which a texture is bound is active, the
bound texture is used. In effect, the texture targets
become aliases for the textures currently bound to them,
and the texture name zero refers to the default textures
that were bound to them at initialization.
A texture binding created with glBindTexture remains
NOTES
glBindTexture is available only if the GL version is 1.1
or greater.
ERRORS
GL_INVALID_ENUM is generated if _param1 is not one of the
allowable values.
GL_INVALID_OPERATION is generated if _param2 has a dimen-
sionality that doesn't match that of _param1.
GL_INVALID_OPERATION is generated if glBindTexture is exe-
cuted between the execution of glBegin and the correspond-
ing execution of glEnd.
ASSOCIATED GETS
glGet with argument GL_TEXTURE_BINDING_1D
glGet with argument GL_TEXTURE_BINDING_2D
glGet with argument GL_TEXTURE_BINDING_3D
SEE ALSO
glAreTexturesResident, glDeleteTextures, glGenTextures,
glGet,
glGetTexParameter, glIsTexture, glPrioritizeTextures,
glTexImage1D, glTexImage2D, glTexParameter
1