PDA

View Full Version : Is glRotate faster?



haigu
05-11-2001, 03:11 AM
I've come across a question: suppose hardware T&L is not available, then is it faster to let OpenGL do the Rotate, Translate, Scale stuff?

A guy has made a test, comparing the two methods
1.
glRotatef(...);

2.
myMatrix44.Rotate(...);
glMultMatrix((GLfloat*)&myMatrix44);

method 2 is a little bit faster than 1.

why does this happen?
and if OpenGL is not the fastest, then why do all the books recommend us to let OGL doing the matrix calculation for speed purpose?

bsenftner
05-11-2001, 06:13 AM
It depends upon if you are only writing software for yourself, for your machine, which you will never purchase a T&L enabled video card for- or if you plan on having the software you write run on other people's machines that may have T&L hardware. Plus, you will never get updated drivers that may have optimized the glRotate() logic.

Furthermore, is your matrix rotate routine in the form of (axis, angle) like glRotate()? If you are doing separate rotate routines for each axis, sure that would be faster. But remember that glRotate() is an arbitary axis rotation: more general and more complex to execute.

Personally, I don't use glRotate(), I do all my rotations with quats, convert to a matrix and then glMultMatrix().

-Blake