Game Development Reference
In-Depth Information
Texture Magnification and Minification
Texture mapping of fixed size textures to 3D objects that can be scaled, rotated, and translated out
to variable distances from the viewer require that individual texels (pixels of the texture) be mapped to
individual pixels on the final viewing screen. If the texels are enlarged when they are displayed, texture
magnification has occurred. If texels are shrunk when they are displayed on the screen, texture
minification has occurred (see Figure 4-26 ).
Texture (2 by 2 Texels)
Texture (2 by 2 Texels)
On Screen (2 by 2 Pixels)
On Screen (2 by 2 Pixels)
Texture Magnification
Texture Minification
Figure 4-26. Texture magnification and minification
In both cases, the textures will have to be filtered to map the color from the texture to the final color
displayed on the screen. Two of the ways to do this are the following:
GLES20.GL_NEAREST : A filtering method that finds the closest texel to the pixel of
that texture that is being displayed on screen.
GLES20.GL_LINEAR : A filtering method that uses a weighted average of the
closest 2-by-2 group of texels to the pixel of that texture that is being displayed
on the screen.
Texture Clamping and Repeating
Texture coordinates are generally 0 through 1, inclusive. However, you can assign texture coordinates
outside this range to vertices and have the textures clamped or repeated (see Figure 4-27 ). Texture
clamping uses 1.0 for texture coordinates that are greater than 1 and 0 for texture coordinates that
are less than 0. Texture repeating tries to fit multiple copies of the texture into texture coordinates
that are greater than 1 or less than 0.
 
Search WWH ::




Custom Search