In our init function we establish the clear color and set the values used in creating our scene. Our world consists of two objects -- a checker like board and a surface of revolution. In addition to the light color, which we store in the array lightColor, we store the color of the surface of revolution in the array geometryColor. Note that the fourth component of this array is the alpha value of the color. Some of the colors for painting the squares of the checker board are mixed using the HSV color model. The HSV class definition resides in the Utils library. Last, the surface of revolution is constructed from a Bezier spline. We store the eight control points used for this spline in the array coordinates. The data type Coordinates for the components of the array is also defined in Utils.
Another initialization we include in Init is setting the viewing and projection transformations. Last, we set the lighting with a call to the function SetLighting that is part of our class CGWorld. Note that the call is made after the viewing transformation is set. Doing it in this order is important since OpenGL applies the current matrix on the model-view stack to the geometric data values of the light (e.g. position and direction). Therefore, we want our viewing transformation to be the one used when we set the lights.