Moving, rotating, and scaling objects
OpenGL offers you stack-based matrix transformations. These transformations include translating—moving, rotating, and scaling. Stacking means that previous transformations can affect succeeding transformations and they create the hierarchical structure. A typical example may be a human-like arm simulation. The arm consists of several parts connected with joints. Each part's position and orientation is dependent on the position and orientation of the previous part. Similar rules of dependency apply to all parts of the solar system. Planets orbit around stars and moons orbit their planets at the same time.
This recipe will show you how to create a simple scene with your own animated miniature of the solar system.
Getting ready
The core to success with scene animation is to understand how matrix transformations affect parts of your scene. There are four main rules to remember:
Each transformation changes the state of the local coordinate system, so the order...