I want to rotate a 3d object in a roll pitch yaw fashion. I store the pose of the object in a matrix, and perform roll, pitch and yaw rotations multiplying the pose matrix by one of the standard rotation matrices about x, y, or z axis.
Then I display it using these lines of code.
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(-5, 5, 2, 0, 0, 0, 0, 1, 0);
glPushMatrix();
ship.Draw();
glPopMatrix();
glutSwapBuffers();
}
void Spacecraft::Draw(){
glMultMatrixf(pose);
model.Draw();
return;
}
It works, but the object, instead to rotate around their own axis it rotates around the world axis... Where am I wrong?