There are a few things about openGL and rotations and translations that you should know and maybe hard to grasp at first.
First all openGL operations start at 0,0,0 as the axis point.
glRotate( Angle of rotation(0-360), X, Y, Z) Where XYZ is what axis to rotate, 0 = No-rotation, 1 = rotation per Angle.
The rotation is done around 0,0,0 as the axis, so if your object is not draw with 0,0,0 being is center then it rotates with an offset.
Let’s say you have a cube it has one corner as 0,0,0 and the far corner is 1,1,1. In order to rotate the cube around it’s center we must move it’s center to 0,0,0.
glRotate(angle, 1, 0, 0); // Rotate around X axis
glTranslate(-0.5, -0.5, -0.5); // Move cubes center from 0.5,0.5,0.5 to 0.0, 0.0, 0.0;
Draw_cube();
Now also remember openGL does operations work in reverse, so that the glTranslate is done frist even though we called it last.
So what happens is the cube has it center translated to 0,0,0, then we rotated around it’s center.
Hope this helps.
Originally posted by badwhorsey:
[b]So does that mean I don’t need the actual coordinates, do I just need to pick the axis to rotate on by setting it to 1?
Wes[/b]