Im wondering which way is fastest for matrix transformation - to use glRotatef or my own pice of code (written on assembler)?

and for extra marks, “how long is this piece of string”?

Im using assembler source from one tutorial about optimization (http://www.cortstratton.org/articles/OptimizingForSSE.php)

GPU’s are very efficient these days, and by using opengl matrix calls you would be utilizing hardware transformations which can be mighty fast!

Originally posted by TheC0der:

Im wondering which way is fastest for matrix transformation - to use glRotatef or my own pice of code (written on assembler)?

As usual, it depends - when you emit many glVertex’es without changing the transformation, it doesn’t matter. Vertices will always be transformed by the current modelview matrix. But when you change the transformation often, chances are that your matrix manipulation is faster than the one of the vendor’s OpenGL library.

But remember that you still have to call glLoadMatrix or glMultMatrix with your matrix, and if you want to replace glMultMatrix with hand-crafted code, I would assume that getting the top entry on the matrix stack requires a server round trip (talking about Linux/X11) and then you won’t have a chance to compete against server-side matrix multiplications.

If you have vertices that require simple or dynamic transforms, chances are that fast CPU-sided code will win against an implementation based on many OpenGL matrix multiplications.