View Full Version : Rotation using glMultMatrix

09-01-2010, 12:31 PM
I need to make a square rotate in circles around the center of the screen, and I did it using the functions glRotate and glTranslate.

Now I have to do the same thing using glMultMatrix instead. Could anybody help me?

Here's the code using glRotate and glTranslate:

glRotatef(angle, 0.0, 0.0, 1.0);
glTranslatef(0, -0.5, 0);
glRectf(-0.05, 0.05, 0.05, -0.05);

The variable angle increments from time to time to create the animation.

09-01-2010, 03:48 PM
Is this your homework or something? glRotate and glTranslate both create a matrix and multiply themselves against the current stack. You just need to look at the documentation for these matrices, build the two matrices, multiply the two together, and pack it into an array glLoadMatrix can understand.