Rotation of object

How to ratate the 3D object arround itself in all the axis.

glRotatef(0.0,0.858824f,0.576471f,0.439216f);

I use this cases to rotate my object arround the axis.
case ‘l’:
glRotatef(-1.0,1.0f,0.0f,0.0f);
break;
case ‘r’:
glRotatef(-1.0,0.0f,0.0f,1.0f);
break;
case ‘d’:
glRotatef(-1.0,0.0f,1.0f,0.0f);
but i wand how to rotate object itself.

Rotation transforms are typically about the origin. If you want to rotate about a different point, you have to translate that point to the origin first, then apply the rotate.

… then translate back.

The sequence


glTranslatef(x, y, z);
glRotatef(...);
glTranslatef(-x, -y, -z);

constructs a rotation about the point (x,y,z).

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