Weird Rotation

For some reason I can’t seem to get
glRotatef() to work correctly in my programs
I did try running Nehe’s sample programs(Linux ports)
and they worked so it has nothing to do with
the installation of OpenGL.
When I try to rotate of the X acess with code
like
rotate += 1.0f;
glLoadIdentify();
glTranslate(0.0f,0.0f,-3.0f);
glRotatef(rotate,1.0f,0.0f,0.0f);

I get the object translating in the angle it is rotating.

the has to do with how tranformations are concantonated. the order that you tranform things matters. so, if you want something to rotate around its own origin, you have to rotate first, then translate. otherwise, it will rotate around the point it was at before it was translated (in this case, the world origin).

so, basically, try rotating then translating, and see if that does what you want.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.