# Rotation

With glRotate(90, 0.0, 1.0, 0.0) a cube (for example) is rotated with 90 degrees around oy. But this coordinate system is linked to the cube; it rotates itself together with the cube. I want to use another coordinate system: as I sit down on the chair in front of my computer and I look to the screen, OX is a horizontal line on the screen and OY is a vertical line on the screen. The cross point between them is at the center of the monitor.
If the cube is in a random position (ox, oy and oz have a random orientation), how do I rotate it around X? What about OY?
Thanks a lot!

Let’s see if I understood this.
You have a cube somewhere in the world.
Thze cube’s orientation is (ox, oy, oz).
You have a screen relative coordinate system (OX, OY, OZ) and want to rotate the cube at its position around OX and OY.

First translate the cube’s pivot point to be in the origin of the (OX,OY,OZ) coordinate system. Then rotate it around the axis there and trasnlate it back to the starting point.

If the main goal is to have the orientation (ox, oy, oz) of the cube given in Euler angles updated accordingly, I would change the representation of the orientation to quaternions.
Have a look at the TRACKBALL.C source which can be found in the GLUT examples.