A robot

I have designed a simple robot animation program to deeply understand the setting methods of viewing transformation and geometric transformation in OpenGL as well as the usage of the matrix stack.

The interaction processes are defined as follows:

Left mouse button: Dragging it will move the camera on the XOY plane. Right mouse button: Dragging it will rotate the object. Up (Down) arrow keys: Pressing them will move the camera along the viewing direction. Keyboard characters: Pressing the letter “s” will rotate the right arm. Keyboard characters: Pressing the letter “e” will rotate the forearm of the right arm.

Based on this, the following functions are added:

  1. Establish a simple model of the human body, including the torso, arms, hands, legs, and feet.
  2. Add a response to the key ‘h’ to control the rotation of the hands.
  3. Add a response to the key ‘f’ to control the rotation of the feet.
  4. Add a response to the key ‘w’ to simulate the parallel effect of hands and feet when walking (that is, the synchronization of the left arm and the right leg, and the synchronization of the right arm and the left leg).