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. Using the following diagram, we will cover the placement method of objects.


Figure 2-9-1 Example of object placement

  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.
  4. Register the new wheel position in the display list.
  5. Return the model view matrix.

After that, repeat operations of 3 through 5, and the other three wheels will be placed and the car will be registered in the display list. 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 a more efficient and faster construction of the display list.