I’m an experienced C/C++ programmer but newby to OpenGL.
I have followed NeHe tutorials (very good ones!!) and now I’m trying to make a simple programm which travelling the camera across a scene.
I think the best choice is the ‘gluLookAt’ function but some people said this function is very time cost, and a better choice is to use a combination of ‘glRotate’ and ‘glTrasnlate’. Is this true?
If I use this functions I need to make a lot of matrix transformations. Can anyone explain me why gluLookAt is inefficient?
Thanks in advance
gluLookAt should be optimized. I’m really convinced that GLU is not a library for nothing
The main advantage in such an optimization would reside in the fact that gluLookAt uses a single matrix whereas your code (when using glTranslate and glRotate) will have at least two matrices (and generally four because of the 3 axis rotations). This will imply several matrix multiplications that is obviously less fast than a single one.
There are also several other reasons depending on your needs.
So, as long as you don’t require special needs, you really should gluLookAt for helping you.
thank you for both responses. Now I get a clear idea of the gluLookAt