Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualSimonForsman

Posted 18 June 2013 - 01:00 AM

is there anyway to rotate an object without using the glRotatef function?

 

Yes, you can create a transformation matrix manually. (Rotatef is really just a shorthand function for creating and applying a rotation matrix to the current matrix (the one at the top of the stack). you can push and pop matrices to/from the stack using glpushmatrix/popmatrix and resetting the top matrix using glLoadIdentity(), or load your own matrix to the top of the stack using glLoadMatrix.

 

The only thing you should never do(unless you got a very low number of vertices in which case software transformation might be faster than creating the matrix, but then it most likely doesn't matter what you do anyway) is modify the vertex positions directly, each vertex is transformed using the transformation and projection matrices by the hardware (and it has to do that anyway)


#1SimonForsman

Posted 18 June 2013 - 12:59 AM

is there anyway to rotate an object without using the glRotatef function?

 

Yes, you can create a transformation matrix manually. (Rotatef is really just a shorthand function for creating and applying a rotation matrix to the current matrix (the one at the top of the stack). you can push and pop matrices to/from the stack using glpushmatrix/popmatrix and resetting the top matrix using glLoadIdentity(), or load your own matrix to the top of the stack using glLoadMatrix.

 

The only thing you should never do(unless you got a very low number of vertices in which case software transformation might be faster than creating the matrix, but then it most likely doesn't matter what you do anyway) is modify the vertex positions directly, each vertex is transformed using the transformation matrix by the hardware (and it can transform millions of vertices really really fast)


PARTNERS