Materials, textures, and shaders
In Chapter 3, Cardboard Box, we introduced the OpenGL ES 2.0 graphics pipeline and simple shaders. We will now extract that code into a separate Material
class.
In computer graphics, materials refer to the visual surface characteristics of geometric models. When rendering an object in the scene, materials are used together with lighting and other scene information required by the shader code and the OpenGL graphics pipeline.
A solid colored material is the simplest; the entire surface of the object is a single color. Any color variation in the final rendering will be due to lighting, shadows, and other features in a different shader variant. It is quite possible to produce solid color materials with lighting and shadows, but the simplest possible example just fills raster segments with the same color, such as our very first shader.
A textured material may have surface details defined in an image file (such as a JPG). Textures are like wallpapers pasted on the...