You’re question is very vague.
Please elaborate a little more in your next post.
What I understand from you’re question is that you want to rotate the rectangle about its center but it is unclear whether you want it to rotate uniformly or in a predetermined haphazard fashion.
We’ll if you want uniform rotation its simple. All you need to do is increment (or decrement) you’re angle in the pseudo code provided by MatchStickMan in certain steps (say 5 degrees every step) and run you’re animation using the glutTimerFunc.
This is nothing but a timer call-back where you can run any segment of you’re code periodically. For animations usually you would simply want to redraw you’re screen so you call a glutPostRedisplay.
heres the pseudo code for the timer call back
void timer(int i)
glutTimerFunc(TIME,timer,1); //here TIME is you’re
// timer period in
you can register the time call back by including the following line in you’re main function
As for the haphazard rotation. You do need certain math depending on you’re requirements.
For a controlled rotation you may want to refer to my post “Rotating a cube with the mouse”.