gluLookAt Question

Hi, does anyone know if the following two pieces of code are identical:
code 1:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-50, 50, -50, 50, 10, 100);
gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

code 2:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-50, 50, -50, 50, 10, 100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);

I mean does gluLookAt always operate on the modelview matrix, regardless of the state of the current matrix, or calling it while inside the projection matrix it operates on the projection matrix? Thanks in advance.
Dimitris

No, they are not identical. gluLookAt, like ALL functions that operate on matrices, affects the matrix currently selected with glMatrixMode. You should always be using gluLookAt in the MODELVIEW matrix, or you will end up affecting things like lighting and fog calculations.

Given nothing else, if you multiply a vertex by the MODELVIEW and PROJECTION matrices, you will get the same result in both of your examples for the final vertex position, but certain calculations like lighting and fog, only take the MODELVIEW matrix into account, and thus wouldn’t know about your “camera” transformation.

[This message has been edited by Deiussum (edited 11-13-2003).]