transform the world coordinate

I learn that the opengl world coordinate is that x goes ritgt, y goes up and z goes to you.

if I want to transform the world coodinates and then make object rotate and translate about the new coordinates, how do I perform this?

thanks in advance


If you want (x, y, z) to be your new origin, and (x-rot, y-rot, z-rot) your orientation, do this:

glTranslatef(x, y, z);
glRotatef(x-rot, 1.0, 0.0, 0.0);
glRotatef(y-rot, 0.0, 1.0, 0.0);
glRotatef(z-rot, 0.0, 0.0, 1.0);


You can then translate and rotate away from this point, and if you want to return, just pop the matrix. Don’t forget to push again when you want multiple objects in your new coordinate system.

Hope this helps