OpenGL Distilled

4.7. More Information

For information on OpenGL lighting topics not covered in this chapter (such as spotlights, attenuation, lighting model parameters, emissive and ambient light, precise details of OpenGL light equations, and lighting in color index mode), see the following:

  • Chapter 5, "Lighting," of OpenGL® Programming Guide

  • Section 2.14.1, "Lighting," of The OpenGL Graphics System

  • "glColorMaterial," "glLight," "glLightModel," and "glMaterial" in OpenGL® Reference Manual

Because OpenGL applies textures after performing lighting calculations, geometry that is both lit and textured requires special treatment. Chapter 6, "Texture Mapping," discusses techniques for applying textures that preserve OpenGL lighting effects.

OpenGL lighting creates shading effects but doesn't create shadows from one surface on to another. You can implement one of many algorithms in your OpenGL application to create shadows. For information on creating shadow effects, see the following:

  • Chapter 6, "Texture Mapping," describes shadow algorithms using OpenGL textures.

  • Chapter 14, "Now That You Know," of OpenGL® Programming Guide describes the planar projected shadow technique, which renders projected shadow geometry on a plane surface.

The OpenGL® Distilled Web site has two examples that demonstrate shadow techniques and other examples that also employ lighting. The OpenGL Web site at http://www.opengl.org also has several coding resources online, including lighting and shadow example code.

Категории