hide random home http://www.sgi.com/tech/openGL/mjk.xlib/subsubsection3_2_2_2.html (Silicon Surf Promotional CD, 01/1995)



Next: 2.2.3 Back-face Culling Up: 2.2 The Dinosaur Model Previous: 2.2.1 The GLU Tessellator

2.2.2 Hierarchical Display Lists

After generating the complex polygon display list for the sides of a solid object, the extrudeSolidFromPolygon routine creates another display list for the ``edge'' of the extruded solid. The edge is generated using a QUAD_STRIP primitive. Along with the vertices, normals are calculated for each quad along the edge. Later these normals will be used for lighting the dinosaur. The normals are computed to be unit vectors. Having normals specified as unit vectors is important for correct lighting. An alternative would be to use glEnable(GL_NORMALIZE) which ensures all normals are properly normalized before use in lighting calculations. Specifying unit vectors to begin with and not using glEnable(GL_NORMALIZE) saves time during rendering. Be careful when using scaling transformations (often set up using glScale) since scaling transformations will scale normals too. If you are using scaling transformations, glEnable(GL_NORMALIZE) is almost always required for correct lighting.

Once the edge and side display lists are created, the solid is formed by calling the edge display list, then filling in the solid by calling the side display list twice (once translated over by the width of the edge). The makeDinosaur routine will use extrudeSolidFromPolygon to create solids for each body part needed by the dinosaur.

Then makeDinosaur combines these display lists into a single display list for the entire dinosaur. Translations are used to properly position the display lists to form the complete dinosaur. The body display list is called; then arms and legs for the right side are added; then arms and legs for the left side are added; then the eye is added (it is one solid which pokes out either side of the dinosaur's head a little bit on each side).


mjk@asd.sgi.com
Wed Oct 19 18:11:46 PDT 1994