Graphics Window Light and Materials
 
 
 

The geometric primitives in a GraphicsWindow do not directly support lighting. However polylines and polygons can be provided with colors for each vertex. If provided (and the current rendering mode/limit allows for it), the device driver will interpolate the vertex colors as the primitive is rasterized.

To facilitate the lighting process, there are methods to specify light properties (type, color, angles, etc.), position and direction, and to specify material properties (ambient, diffuse, and specular colors, etc.) Once a material and a set of lights are specified, a given vertex / normal vector pair may be "rendered" by calling the GraphicsWindow::lightVertex() method. This method uses the position and normal vector direction to produce an RGB triple representing the illuminated color.

Logically speaking, for illuminated primitives the pipeline described above is modified by having each vertex lit at the time it is transformed. The resulting RGB triples can then be cached and later used during rendering of the primitive. In the mesh class, the actual renderer uses a lazy evaluation algorithm so that only vertices that may appear on-screen are illuminated.