Thanks, but that's not quite what I want to do. I want to draw a 1 unit cube which is centred on the origin (ie the x/y/z faces are all at +/- 0.5).
I want that cube to rotate around the origin - the cube should never leave its original enclosing sphere.
But, I also want the cube to have its own coordinate system, so that I can draw a point inside the cube using coordinate values between 0 and 1. I hope that is clear, its a bit confusing to describe.
My thinking was, first rotate (about the origin) then translate to move the origin to (-.5, -.5, -.5), but that doesn't work at all. Possibly I am misunderstanding how translate works?
Rotation is always about the origin, but you can move the origin with glTranslate(). If don't want the view of the object to be translated after you've done the rotation just translate back.
1 2 3
| glTranslate(center.x,center.y,center.z); glRotate(angle,axis.x,axis.y,axis.z); glTranslate(-center.x,-center.y,-center.z); |