Understanding Textures

Textures in OpenGL can be used to represent images, pictures, and even fractal data that are generated by a mathematical algorithm. Each two-dimensional texture is composed of many small texels, which are small blocks of data analogous to the fragments and pixels that we’ve talked about previously. The most common way to use a texture is to load in the data directly from an image file.

We’ll use the image in Figure 36, The Surface Image as our new air hockey table surface and load it in as a texture:

Figure 36. The Surface Image

All of the images used in the code can be downloaded from this book’s home page. I recommend ...

Get OpenGL ES 2 for Android now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.