The example uses two lights. Both use only the diffuse component. A bright, slightly green-tinted positional light is to the right, front of the dinosaur. A dim, red-tinted directional light is coming from the left, front of the dinosaur. Figure 3 shows how the dinosaur, the lights, and the eye-point are arranged. A positional light is located at some finite position in modeling space. A directional light is considered to be located infinitely far away. Using a directional light allows the OpenGL to consider the emitted light rays to be parallel by the time the light reaches the object. This simplifies the lighting calculations needed to be done by OpenGL.
The lightZeroPosition and lightOnePosition static variables indicate the position of the two lights. You will notice each has not three but four coordinates. This is because the light location is specified in homogeneous coordinates. The fourth value divides the X, Y, and Z coordinates to obtain the true coordinate. Notice how lightOnePosition (the infinite light) has the fourth value set to zero. This is how an infinite light is specified.
The dinosaur can rotate around the Y axis based on the user's mouse input. The idea behind the example's lighting arrangement is when the dinosaur is oriented so its side faces to the right, it should appear green due to the bright light. When its side faces leftward, the dinosaur should appear poorly lighted but the red infinite light should catch the dinosaur's red eye.
Section 9 of the program initialization shows how lighting is initialized. The glEnable(GL_LIGHTING) turns on lighting support. The lights' positions and diffuse components are set using via calls to glLightfv using the GL_POSITION and GL_DIFFUSE parameters. The lights are each enabled using glEnable.
The attenuation of the green light is adjusted. This determines how the light intensity fades with distance and demonstrates how individual lighting parameters can be set. It would not make sense to adjust the attenuation of the red light since it is an infinite light which shines with uniform intensity.
Neither ambient nor specular lighting are demonstrated in this example so that the effect of the diffuse lighting would be clear. Specular lighting might have been used to give the dinosaur's eye a glint.
Recall when the edge of each solid was generated, normals were calculated for each vertex along the quad strip. And a single normal was given for each complex polygon side of the solid. These normals are used in the diffuse lighting calculations to determine how much light should be reflected. If you rotate the dinosaur, you will notice the color intensity changes as the angle incidence for the light varies.
Also notice the calls to glShadeModel. OpenGL's shade model determines whether flat or smooth shading should be used on polygons. The dinosaur model uses different shading depending on whether a side or edge is being rendered. There is a good reason for this. The GL_SMOOTH mode is used on the sides. If flat shading were used instead of smooth, each convex polygon composing the tessellated complex polygon side would be a single color. The viewer could notice exactly how the sides has been tessellated. Smooth shading prevents this since the colors are interpolated across each polygon.
But for the edge of each solid, GL_FLAT is used. Because the edge is generated as a quad strip, quads along the strip share vertices. If we used a smooth shading model, each edge between two quads would have a single normal. Some of the edges are very sharp (like the claws in the hand and the tip of the tail). Interpolating across such varying normals would lead to an undesirable visual effect. The fingers would appear rounded if looked at straight on. Instead, with flat shading, each quad gets its own normal and there is no interpolation so the sharp angles are clearly visible.