Graphics Programs Reference
In-Depth Information
Ginsburg and Dave Shreiner (Addison-Wesley, 2008), from which
this quotation is taken.
The third argument is the Bitmap resource, which has to be decoded for use (as
shown in Listing 5-5 ) . In the last argument, you must specify the border. For most
cases, this is set as “0”, meaning “no-border.”
In Listing 5-5 , the code snippet used between the calls to
GLES20.glBindTexture and GLUtils.texImage2D is used to fetch the
image resource, which is used as a texture, and set the texture parameters. You
must understand the use of the following call— glTexParamet-
eri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S,
GLES20.GL_REPEAT) . This sets the repeat wrap mode for the s-coordinate of
texture. The call to glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST) sets the
minification filter to GL_NEAREST . To try the two filtering modes in a real applic-
ation, modify the Renderer class in the GL TEXTURE application to reflect these
changes. You can load this application into your Eclipse workspace by importing the
archive file Chapter5/gltexture.zip .
In the Renderer class of this application, set the GL_TEXTURE_MIN_FILTER and
GL_TEXTURE_MAG_FILTER - each of these modes, to use GL_LINEAR filter.
The output, after making this change, is similar to Figure 5-4 , but the texture will
be hazy because of bilinear sampling caused by the use of GL_LINEAR filter.
The
following
line
of
code— GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT,
1) —in Listing 5-5 is used to specify the byte boundary for the rows of pixel (image)
data.
 
Search WWH ::




Custom Search