C++:Spinning Tutorial

From Progzoo
Jump to: navigation, search

Spin a Cube

You can draw a triangle and have it spin when idle.

  • glutGet(GLUT_ELAPSED_TIME) returns the number of milliseconds since the program started
  • You must save the current state with glPushMatrix before rotating, then retrieve it with glPopMatrix

Change the code so that the cube rotates about the x axis.



[Font] [Default] [Show] [Resize] [History] [Profile]

Spin around the diagonal

Try doubling the speed of rotation and spin the cube about the diagonal. If it works then two corners of the cube will remain in place



[Font] [Default] [Show] [Resize] [History] [Profile]