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:

images/Textures/AirHockeySurface.png
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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.