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 ...

Get Cardboard VR Projects 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.