Rotating in OpenGL relative to the viewport
- by Nick
I'm trying to display an object in the view which can be rotated naturally by dragging the cursor/touchscreen. At the moment I've got X and Y rotation of an object like this
glRotatef(rotateX, 0f, 1f, 0f); // Dragging along X, so spin around Y axis
glRotatef(rotateY, 1f, 0f, 0f);
I understand why this doesn't do what I want it to do (e.g. if you…