3.8.4 Texture Objects
Next: 3.8.5 Texture Environments and
Up: 3.8 Texturing
Previous: 3.8.3 Texture State and
3.8.4 Texture Objects
In addition to the default textures TEXTURE_1D and TEXTURE_2D,
named one- and two-dimensional texture objects can be created and operated
upon.
The name space for texture objects is the unsigned integers,
with zero reserved by the GL.
A texture object is created by binding an unused name to
TEXTURE_1D or TEXTURE_2D.
The binding is effected by calling
void BindTexture ( enum target, uint texture ) ;
with target set to the desired texture target
(either TEXTURE_1D or TEXTURE_2D)
and texture set to the unused name.
The resulting texture object is a new state vector,
comprising all the state values listed in subsection 3.8.3,
set to the same initial values.
If the new texture object is bound to TEXTURE_1D,
it is and remains a one-dimensional texture until it is deleted.
Likewise,
if the new texture object is bound to TEXTURE_2D,
it is and remains a two-dimensional texture until it is deleted.
BindTexture may also be used to bind an existing texture object
to either TEXTURE_1D or TEXTURE_2D.
The error INVALID_OPERATION is generated if an attempt is made
to bind a one-dimensional texture object to TEXTURE_2D,
or to bind a two-dimensional texture object to TEXTURE_1D.
If the bind is successful no change is made to the state of the bound
texture object,
and any previous binding to target is broken.
While a texture object is bound,
GL operations on the target to which it is bound affect the bound object,
and queries of the target to which it is bound return state from the bound
object.
If texture mapping of the dimensionality of the target to which a texture
object is bound is enabled,
the state of the bound texture object directs the texturing operation.
In the initial state
TEXTURE_1D and TEXTURE_2D have one-dimensional and
two-dimensional texture state vectors associated with them.
In order that access to these initial textures not be lost,
they are treated as texture objects whose names are both 0.
The initial one-dimensional texture is therefore operated upon,
queried, and applied as TEXTURE_1D while 0 is bound to
TEXTURE_1D.
Likewise,
the initial two-dimensional texture is therefore operated upon,
queried, and applied as TEXTURE_2D while 0 is bound to
TEXTURE_2D.
Texture objects are deleted by calling
void DeleteTextures ( sizei n, uint *textures ) ;
*textures contains n names of texture objects to be deleted.
After a texture object is deleted,
it has no contents or dimensionality,
and its name is again unused.
If a texture that is currently bound to TEXTURE_1D is deleted,
it is as though BindTexture had been executed with argument values
TEXTURE_1D and zero, respectively.
Likewise,
if a texture that is currently bound to TEXTURE_2D is deleted,
it is as though BindTexture had been executed with argument values
TEXTURE_2D and zero.
Unused names in *textures are silently ignored,
as is the value zero.
The command
void GenTextures ( sizei n, uint *textures ) ;
returns n previously unused texture object names in *textures.
These names are marked as used,
but they acquire texture state and a dimensionality only when
they are first bound,
just as if they were unused.
An implementation may choose to establish a working set of texture objects
on which binding operations are performed with higher performance.
A texture object that is currently part of the working set is
said to be resident.
The command
boolean AreTexturesResident ( sizei n, uint *textures, boolean *residences ) ;
returns TRUE if all of the n texture objects named in *textures are
resident,
or if the implementation does not distinguish a working set.
If at least one of the texture objects named in *textures is not resident,
then FALSE is returned,
and the residence of each texture object is returned in *residences.
Otherwise the contents of *residences are not changed.
If any of the names in *textures is not the name of a texture object,
FALSE is returned,
the error INVALID_VALUE is generated,
and the contents of *residences are indeterminate.
The residence status of a single bound texture object can also be queried
by calling GetTexParameteriv or GetTexParameterfv
with target set to the target to which the texture object is bound,
and pname set to TEXTURE_RESIDENT.
AreTexturesResident indicates only whether a texture object is currently
resident,
not whether it could not be made resident.
An implementation may choose to make a texture object resident only on first
use,
for example.
The client may guide the GL implementation in determining which
texture objects should be resident by specifying a priority for each
texture object.
The command
void PrioritizeTextures ( sizei n, uint *textures, clampf *priorities ) ;
sets the priorities of the n texture objects named in *textures
to the values in *priorities.
Each priority value is clamped to the range [0,1] before it is assigned.
Zero indicates the lowest priority,
with the least likelihood of being resident.
One indicates the highest priority,
with the greatest likelihood of being resident.
The priority of a single bound texture object may also be
changed by calling
TexParameteri , TexParameterf , TexParameteriv , or
TexParameterfv with target set to the target to which the
texture object is bound,
pname set to TEXTURE_PRIORITY,
and param or params specifying the new priority value
(which is clamped to the range [0,1] before being assigned).
PrioritizeTextures silently ignores attempts to prioritize unused
texture object names or default textures.
Next: 3.8.5 Texture Environments and
Up: 3.8 Texturing
Previous: 3.8.3 Texture State and
David Blythe
Sat Mar 29 02:23:21 PST 1997
Wyszukiwarka
Podobne podstrony:
node87 K7XCVNZBQYIQVIY26ZDNDTOCMD36UPVFQY6BPIInode87 TCE2YVGBVWFZYQW5AARVAH6P3TGRPKX3A5GWIAAnode87 1node87node87node87 ZSHPB7IDVIHJTYVSX5EVIUF7UMABU3D6EJ4OJGAwięcej podobnych podstron