Chapter 5. Lighting

Chapter Objectives

After reading this chapter, you’ll be able to do the following:

• Understand how real-world lighting conditions are approximated by OpenGL

• Render illuminated objects by defining light source, material, and lighting model properties

• Define the material properties of the objects being illuminated

• Manipulate the matrix stack to control the positions of light sources

Note

In OpenGL Version 3.1, many of the techniques and functions described in this chapter were removed through deprecation. The concepts are still relevant, but computing colors through lighting must be done in either a vertex or fragment shader. These topics are briefly described in Chapter 15, and fully explained in the companion ...

Get OpenGL Programming Guide: The Official Guide to Learning OpenGL, Versions 3.0 and 3.1, Seventh Edition 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.