
Originally Posted by
novice01
Hi,
I am new to OpenGL programming and this is my first post in the forum, so hello everyone.
I have been having this problem with this successive translation and rotation thing. Suppose I want to move a cube 5 units down the +x axis and then rotate this 45 degrees about the initial origin. So the cube would be midway between x and y axis. But the code snippet I am writing in a display function is able to translate it 5 units but the rotation is about the cube's coordinate system so the cube remains in the x -axis only. Where could I be going wrong?
gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glPushMatrix();
glTranslatef(5.0, 0.0, 0.0);
glRotatef (45.0, 0.0, 0.0, 1.0);
glutWireCube (1.0);
glPopMatrix();
Please let me know if the question is unclear.