I am wanting to navigate a 3D scene using the keyboard.
I use the arrow keys to translate and another couple of keys for rotation on the y-axis.
Before I draw the scene I do the following translations:
glRotatef(rotY, 0, 1.0f, 0);
glTranslatef(posX, posY, posZ);
Is this the correct order for the translations ie. rotaiton, then translation? It doesn’t look right somehow.
Since you are actually transforming the world instead of the camera, you need to negate the x, y, z, and rotation, and do the translation and rotation in the opposite order. You should do the rotation first, then the translation. Think of it this way, if you want to move the camera toward something, you actually do it by moving the thing toward the camera. If you want to turn the camera to the left, you must rotate the world to the right.