%mathent; ]> 1991-2006 Silicon Graphics, Inc. 2010-2014 Khronos Group glBindTexture 3G glBindTexture bind a named texture to a texturing target C Specification void glBindTexture GLenum target GLuint texture Parameters target Specifies the target to which the texture is bound. Must be either GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_2D_ARRAY, or GL_TEXTURE_CUBE_MAP, texture Specifies the name of a texture. Description glBindTexture binds the texture object with name texture to the texture target specified by target. Calling glBindTexture with target set to GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_2D_ARRAY, or GL_TEXTURE_CUBE_MAP and texture set to the name of the new texture binds the texture name to that target. When a texture is bound to a target, the previous binding for that target is automatically 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 contents are local to the shared object space of the current GL rendering context; two rendering contexts share texture names only if they explicitly enable sharing between contexts through the appropriate GL windows interfaces functions. You must use glGenTextures to generate a set of new texture names. When a texture is first bound, it assumes the specified target: A texture first bound to GL_TEXTURE_2D becomes two-dimensional texture, a texture first bound to GL_TEXTURE_3D becomes three-dimensional texture, a texture first bound to GL_TEXTURE_2D_ARRAY becomes two-dimensional arary texture, and a texture first bound to GL_TEXTURE_CUBE_MAP becomes a cube-mapped texture. The state of a two-dimensional texture immediately after it is first bound is equivalent to the state of the default GL_TEXTURE_2D at GL initialization, and similarly for the other texture types. 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. 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 active until a different texture is bound to the same target, or until the bound texture is deleted with glDeleteTextures. Once created, a named texture may be re-bound to its same original target as often as needed. It is usually much faster to use glBindTexture to bind an existing named texture to one of the texture targets than it is to reload the texture image using glTexImage2D, glTexImage3D or another similar function. Texture binding is affected by the setting of the state GL_ACTIVE_TEXTURE (see glActiveTexture). A texture object may be bound to more than one texture unit simultaneously. Errors GL_INVALID_ENUM is generated if target is not one of the allowable values. GL_INVALID_OPERATION is generated if texture was previously created with a target that doesn't match that of target. Associated Gets glGet with argument GL_TEXTURE_BINDING_2D, GL_TEXTURE_BINDING_3D, GL_TEXTURE_BINDING_2D_ARRAY, or GL_TEXTURE_BINDING_CUBE_MAP. API Version Support glBindTexture See Also glDeleteTextures, glGenTextures, glGet, glGetTexParameter, glIsTexture, glTexImage2D, glTexImage3D, glTexParameter Copyright Copyright 1991-2006 Silicon Graphics, Inc. Copyright 2010-2014 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.