2.2.9 Use of Model View Matrix Stack

When you place an object in the 3D world coordinate system, you may find it convenient to keep the relative object-to-object placement information. For example, consider the following illustration and steps:

Illustration

  1. Place the car in the world coordinate system and store the information about the car's direction of movement in the model view matrix.
  2. Register the car body in the display list.
  3. Push the current model view matrix to the stack and calculate a new wheel position based on the information about the car's direction and speed.
  4. Register the new wheel position in the display list
  5. Return the model view matrix
  6. Repeat steps 3 through 5 for each of the other three wheels

Also, if you often display the same objects, leave the calculation to the RCP, so that you can allocate the CPU processing time to other processes. This makes for more efficient and faster construction of the display list.