PDA

View Full Version : Pushing&Popping Vs LoadIdentity



e0e
07-12-2001, 05:09 AM
In my code I need to do change the camera position as fast as possible many times, and it would be really handy to know what is the fastest way to change the Modelview matrix, basically does anyone know which is faster:

glLoadIdentity()
gluLookAt(View1)...

glLoadIdentity()
gluLookAt(View2)...

glLoadIdentity()
gluLookAt(View3)...
etc...

or
glLoadIdentity()

glPushMatrix()
gluLookAt(View1)...
glPopMatrix()

glPushMatrix()
gluLookAt(View2)...
glPopMatrix()

glPushMatrix()
gluLookAt(View3)...
glPopMatrix()
etc...

Or is there no difference?

chennes
07-12-2001, 07:24 AM
Compared to the time it takes to render your scene between calls, there is virtually no difference. If I had to guess, though, I'd say that the glLoadIdentity is marginally faster. Though as usual, this is probably hardware dependant.

Chris

e0e
07-12-2001, 07:54 AM
Cheers I was kind of expecting there to be not much in it. The scene takes virtually no time to render, and the viewpoint is changed every frame so thats why I wanted it fast as possible.

Rob The Bloke
07-12-2001, 04:30 PM
Unless you views need to change, you could place the calls in display lists. But if the code is fast enough already then there may be little point.