help with glrotatef(...)

Started by
2 comments, last by puma 22 years, 3 months ago
I would like to rotate a cube around it''s centerpoint, so that it would stay on it''s position and rotate. Problem is, that rotatef rotates the cube around the origin. How can I get the cube rotating around it''s center? Thanks!
Advertisement
its a common simple problem. What you probably have is something like this:

glVertex2f(0,0);
glVertex2f(10,0);
glVertex2f(10,10);
glVertex2f(0,10);


What you need to do is move the cube over so the center of it is at (0,0)

like this:
glVertex2f(-5,-5);
glVertex2f(5,-5);
glVertex2f(5,5);
glVertex2f(-5,5);






or use glTranslate3f() to centre the cube first


Beer - the love catalyst
good ol'' homepage
Beer - the love catalystgood ol' homepage
First use glTranslatef, and after that glRotatef.

This topic is closed to new replies.

Advertisement