help with glrotatef(...)
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!
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);
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);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement