Here are nine examples illustrating various aspects of illumination in OpenGL.
- exampleSphere01.cpp Grey sphere, one light.
- exampleSphere02.cpp Same sphere, ambient only (flat).
- exampleSphere03.cpp Same sphere, ambient and difffuse only.
- exampleSphere04.cpp Same as example 1, but brighter material.
- exampleSphere05.cpp Same as example 4, but material is green.
- exampleSphere06.cpp Example 4 with green and red light.
- exampleSphere07.cpp Brass Sphere.
- exampleFace01.cpp Green and red light shining on white face.
- exampleFace02.cpp Face with attenuation, added ambient white.
The code is also available with a makefile in tar and zip files
Here is what the examples look like, although recall these all have navigation which lets you change the viewpoint.