Pushing&Popping Vs LoadIdentity

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?

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

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.

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.