Rotation

Hi All,

I have a question regarding the rotation in
opengl,I am trying to rotate the sphere either vertically or horizontally from any position,but when I rotate it horizontally by
some angle say 45 degree and then try to rotate it vertically,it seems like slipping along some axes.I am interested in only vertical and horizontal rotation from any current position.

Any suggestion??

Many thanks
Dev

Are you sure that you apply glTranslate and glRotate in correct order ? If you send your rendering code, we can check that.

Many thanks.

I tried using this,
But it is not working.
glTranslatef(0,0,Z);
glRotatef(Za,0,0,1);
glTranslatef(0,0,-Z);

Hi,
I think I have what you need : in my engine, I have a rotation system to optain a Roll/Yaw/Pitch for hirarchical z,y,x axis(like a plane).

glLoadIdentity();
glTranslatef (x_pos,y_pos,z_pos);
glRotatef (y_yaw,0, 2, 0);
glRotatef (x_pitch,1, 0, 0);
glRotatef (z_roll,0, 0, 3);
glScalef (x_scale,y_scale,z_scale);

So, this might perform what you need : you can define all 3 axes like if they’re hirarchical, and scale is all time local.

Regards,

Gaby