Lecture 9:
Lighting

Contents

Lecture Objectives

9-1

Lighting Basics

9-2

Enabling Lighting Calculations

9-3

Turning On the Lights

9-4

What Is a Normal Vector?

9-5

Specifying Normals

9-6

Specifying Face Normals

9-7

Specifying Vertex Normals

9-8

Automatic Normalization of Normal Vectors

9-9

Example: normals.c

9-10

Material Properties

9-11

Specifying Material Properties

9-12

Example: materials.c

9-13

Specifying Fast Material Changes

9-14

Fast Material Changes Example

9-15

Example: colorMaterial.c

9-16

Lab: Material Properties

9-17

Specifying Light Source Properties

9-18

Querying Light Source Properties

9-19

Specifying Light Positions

9-20

Light Position and the Modelview Matrix

9-21

Light Source That Moves With the Eye

9-22

Light Source Fixed in a Scene

9-23

Example: lightPosition.c

9-24

Specifying the Lighting Model

9-25

Moving Light Source

9-26

Example: movingLight.c

9-27

Ambient Intensity

9-28

Diffuse Intensity

9-29

Specular Intensity

9-30

The Lighting Equation

9-31

Example: lightIntensity.c

9-32

Hints for Fast Lighting

9-33

Lab: Lighting Properties

9-34

Lecture Summary

9-35

OpenGL Lighting Quick Reference

9-36

OpenGL C Quick Reference

9-37