Camera circle movement

Hey there.

I want to make the camera moving along a circular path around the zero point (0,0,0).
So to calculate the position for the camera I use cos(deg) for the x movement and sin(deg) for the z movement in order to move along the path.
To obtain the zero point centered on the screen I just calculate deg + 180.
When you change your position with deg = 10° you have to turn arround with 190° to obtain the zero point centered.
Since glRotate() does work with degrees I thought this might work.
To put this in a code I did :

static float deg = 0;

if (deg > 360.0)
   deg = 360.0 - deg;

static float temp = 0;
temp = deg + 180.0;
if (temp >= 360.0) temp = 360.0 - temp;

glRotatef(m_Camera.m_Rotate.y , 0.0, 1.0, 0.0);
glTranslatef( cos(inRad(deg)), 0, sin(inRad(deg)) );


This kinda doesn’t work like I want to.
For example, when I move the camera with 45° degrees I have to rotate by 145° to maintain the zero point centered on the screen.
For 90° I have to turn by 180°


Ok, problem is I have to change

temp = deg + 180.0;

to this

temp = deg + 90.0;

But can someone explain why it’s not working or why it’s only working with +90 ?
How does OpenGL rotate ? Clockwise or Counter-clockwise ?

Thanks in advance

Using might make it simpler. You would compute new eye position and then use gluLookAt() to look at (0, 0, 0) (input it as center).

You can see in that “rotation follows the right-hand rule, so if the vector x y z points toward the user, the rotation will be counterclockwise”. Or, in the specification itself, Section 2.12.1: “The computed matrix is a counter-clockwise rotation about the line through the origin with the specified axis when that axis is pointing up (i.e. the right-hand rule determines the sense of the rotation angle)”. See also Appendix B corollary 15.