Binds a named texture to a texturing target.
OpenGL C bindings library: libGL.a
void glBindTextureEXT(GLenum target, GLuint texture)
target | The target to which the texture will be bound. Must be one of GL_TEXTURE_1D, GL_TEXTURE_2D, or GL_TEXTURE_3D_EXT (EXT_texture3D). |
texture | The name of a texture. |
glBindTextureEXT is part of the EXT_texture_object extension. This extension makes it possible to use named 1-, 2-dimensional textures in addition to the usual OpenGL texture targets designated by GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D_EXT, etc.
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 contents are local to the shared display-list space (see glXCreateContext) of the current OpenGL rendering context; two rendering contexts will share texture names only if they also share display lists.
To create a named texture, simply bind a previously-unused texture name to one of the texture targets listed above. This can be accomplished by calling glBindTextureEXT with target set to the appropriate texture target, and texture set to the name of the new texture. When a texture is bound to a target, the previous binding for that target is automatically broken.
Note that glGenTexturesEXT may be used to generate a set of fresh texture names.
When a texture is first bound, it assumes the dimensionality of its target: A texture first bound to GL_TEXTURE_1D becomes one-dimensional (1D), a texture first bound to GL_TEXTURE_2D becomes two-dimensional (2D), a texture first bound to GL_TEXTURE_3D_EXT becomes three-dimensional (3D). The state of a (1D) texture immediately after it is first bound is equivalent to the state of the default GL_TEXTURE_1D at GL initialization, and similarly for 2D and 3D textures.
While a texture is bound, GL operations on the target towhich 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 glBindTextureEXT remains active until a different texture is bound to the same target, or until the bound texture is deleted with glDeleteTexturesEXT.
Once created, a named texture may be re-bound to the appropriate target as often as needed. It is usually much faster to bind an existing named texture to one of the texture targets using glBindTextureEXT than it is to reload the texture image using glTexImage*. For additional control over performance, consider using glPrioritizeTexturesEXT.
glBindTextureEXT is included in display lists.
glBindTextureEXT is part of the EXT_texture_object extension, not part of the core GL command set. If GL_EXT_texture_object is included in the string returned by glGetString, when called with argument GL_EXTENSIONS, extension EXT_texture_object is supported by the connection.
glGet with argument GL_TEXTURE_1D_BINDING_EXT
glGet with argument GL_TEXTURE_2D_BINDING_EXT
glGet with argument GL_TEXTURE_3D_BINDING_EXT
/usr/include/GL/glext.h | Contains extensions to C language constants, variable type definitions, and ANSI function prototypes for OpenGL. |
The glDeleteTexturesEXT subroutine, glGenTexturesEXT subroutine, glGet subroutine, glGetTexParameter subroutine, glIsTexture subroutine, glTexImage1D subroutine, glTexImage2D subroutine, glTexImage3DEXT subroutine, glTexParameter subroutine.