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:
All of the images used in the code can be downloaded from this book’s home page. I recommend ...