rotate x axis : rotates cube on x axis
rotate y axis : rotates cube on y axis
rotate z axis : rotates cube on z axis
with projections turned one etc.
rotate x axis : translates cube on +y axis
rotate y axis : translates cube on -x axis
rotate z axis : rotates cube on z axis
I’m really not sure what is wrong, b/c whenever I comment out any rotations while leaving the projections on, everything runs and looks right, and whenever i comment out the projections(depth test, gl_projection, frustum) and adjust my object’s z back to 0 and uncomment the rotations, it rotates and behaves correctly on each axis.
Looks like your projection matrix is also messing with the rotations.
Don’t forget to load the identity matrix before using glFrustum, otherwise the matrix on top of the stack will be multiplied by the matrix you specify.
So if there happened to be a rotation matrix on the stack, this could explain the result.
just in case, here is the switch statement selection for a triangle :
switch(currentShape)
{
…
case triangle:
glPushMatrix();
glBegin(GL_TRIANGLES);
glVertex3f(-1,0,0); //left
glVertex3f(1,0,0); //right
glVertex3f(0,1,0); //top
glEnd();
glPopMatrix();
break;
…
}
Thanks a lot, I actually changed the arrangements to what I’ve shown you to achieve the same affect. I thought, rotate the shape, then scale the shape, then move the shape. I’m glad you set it right though, thanks a lot really.
So, as long as my translation etc. is relative to the camera, I should maintain this oder? move, rotate, scale?