Graphics Reference
In-Depth Information
2D Texture Arrays
The final type of texture in OpenGL ES 3.0 is a 2D texture array.
The 2D texture array is very similar to a 3D texture, but is used for a
different purpose. For example, 2D texture arrays are often used to
store an animation of a 2D image. Each slice of the array represents
one frame of the texture animation. The difference between 2D texture
arrays and 3D textures is subtle but important. For a 3D texture,
filtering occurs between slices, whereas fetching from a 2D texture array
will sample from only an individual slice. As such, mipmapping is
also different. Each mipmap level in a 2D texture array contains the
same number of slices as the level above it. Each 2D slice is entirely
mipmapped independently from any other slices (unlike the case with
a 3D texture, for which each mipmap level has half as many slices as
above it).
To address a 2D texture array, three texture coordinates ( s , t , r ) are used
just like with a 3D texture. The r -coordinate selects which slice in the 2D
texture array to use and the ( s , t ) coordinates are used on the selected slice
in exactly the same way as a 2D texture.
Texture Objects and Loading Textures
The first step in the application of textures is to create a texture object .
A texture object is a container object that holds the texture data needed
for rendering, such as image data, filtering modes, and wrap modes. In
OpenGL ES, a texture object is represented by an unsigned integer that
is a handle to the texture object. The function that is used for generating
texture objects is glGenTextures .
void glGenTextures (GLsizei n, GLuint * textures )
specifies the number of texture objects to generate
an array of unsigned integers that will hold n texture
object IDs
n
textures
At the point of creation, the texture objects(s) generated by
glGenTextures are an empty container that will be used for loading
texture data and parameters. Texture objects also need to be deleted when
an application no longer needs them. This step is typically done either at
application shutdown or, for example, when changing levels in a game.
It can be accomplished by using glDeleteTextures .
 
 
 
 
Search WWH ::




Custom Search