well I tried sponji code but it still does not rotate around a its central axis after I move it up or down.
That is because he did it in the wrong order.
void DrawShip(float x, float y, float z, float rotation) {
glPushMatrix();
// First rotate.
glRotatef(rotation, 0.0f, 0.0f, 1.0f);
// THEN translate.
glTranslatef(x, y, z);
// Then render the shape of the object, you have already translated and rotated it to the right place
glBegin(GL_LINE_LOOP);
glVertex3f(0.0f,-0.25f,0.0f);
glVertex3f(-0.25f,-0.5f,0.0f);
glVertex3f(-0.5f,-0.5f,0.0f);
glVertex3f(-0.0f,0.5f,0.0f);
glVertex3f(0.5f,-0.5f,0.0f);
glVertex3f(0.25f,-0.5f,0.0f);
glVertex3f(0.0f,-0.25f,0.0f);
glEnd();
glPopMatrix();
}
Case close problem solved stop using trigonometry manually.
L. Spiro