glBindTexture.3   [plain text]


'\" e  
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp May 22 14:44
.ds Dm 7 May 22 14:
.ds Xs 62690     6
.TH GLBINDTEXTURE 3G
.SH NAME
.B "glBindTexture
\- bind a named texture to a texturing target

.SH C SPECIFICATION
void \f3glBindTexture\fP(
GLenum \fItarget\fP,
.nf
.ta \w'\f3void \fPglBindTexture( 'u
	GLuint \fItexture\fP )
.fi

.SH PARAMETERS
.TP \w'\fItexture\fP\ \ 'u 
\f2target\fP
Specifies the target to which the texture is bound.
Must be either
\%\f3GL_TEXTURE_1D\fP,
\%\f3GL_TEXTURE_2D\fP, or
\%\f3GL_TEXTURE_3D\fP.
.TP
\f2texture\fP
Specifies the name of a texture. 
.SH DESCRIPTION
\%\f3glBindTexture\fP lets you create or use a named texture. Calling \%\f3glBindTexture\fP with 
.br
\f2target\fP set to
\%\f3GL_TEXTURE_1D\fP, \%\f3GL_TEXTURE_2D\fP, \%\f3GL_TEXTURE_3D\fP and \f2texture\fP
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 automatically broken.
.P
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 \%\f3glXCreateContext\fP) of the current
GL rendering context;
two rendering contexts share texture names only if they
also share display lists.
.P
You may use \%\f3glGenTextures\fP to generate a set of new texture names.
.P
When a texture is first bound, it assumes the dimensionality of its
target:  A texture first bound to \%\f3GL_TEXTURE_1D\fP becomes
one-dimensional, and a texture first bound to \%\f3GL_TEXTURE_2D\fP becomes
two-dimensional, and a texture first bound to \%\f3GL_TEXTURE_3D\fP becomes
a three-dimensional texture. The state of a one-dimensional texture
immediately after it is first bound is equivalent to the state of the
default \%\f3GL_TEXTURE_1D\fP at GL initialization, and similarly for 
two-, and three-dimensional textures.
.P
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.
.P
A texture binding created with \%\f3glBindTexture\fP remains active until a different
texture is bound to the same target, or until the bound texture is
deleted with \%\f3glDeleteTextures\fP.
.P
Once created, a named texture may be re-bound to the target of the
matching dimensionality as often as needed.
It is usually much faster to use \%\f3glBindTexture\fP to bind an existing named
texture to one of the texture targets than it is to reload the texture image
using \%\f3glTexImage1D\fP, \%\f3glTexImage2D\fP, or \%\f3glTexImage3D\fP.
For additional control over performance, use
\%\f3glPrioritizeTextures\fP.
.P
\%\f3glBindTexture\fP is included in display lists.
.SH NOTES
\%\f3glBindTexture\fP is available only if the GL version is 1.1 or greater.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2target\fP is not one of the allowable
values.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \f2texture\fP has a dimensionality
that doesn't match that of \f2target\fP.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glBindTexture\fP is executed
between the execution of \%\f3glBegin\fP and the corresponding
execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
\%\f3glGet\fP with argument \%\f3GL_TEXTURE_BINDING_1D\fP
.br
\%\f3glGet\fP with argument \%\f3GL_TEXTURE_BINDING_2D\fP
.br
\%\f3glGet\fP with argument \%\f3GL_TEXTURE_BINDING_3D\fP
.SH SEE ALSO
\%\f3glAreTexturesResident\fP,
\%\f3glDeleteTextures\fP,
\%\f3glGenTextures\fP,
\%\f3glGet\fP,
.br
\%\f3glGetTexParameter\fP,
\%\f3glIsTexture\fP,
\%\f3glPrioritizeTextures\fP,
\%\f3glTexImage1D\fP,
\%\f3glTexImage2D\fP,
\%\f3glTexParameter\fP