gluLookat , where to use it ?

I am a little confused about where to use
the gluLookat function.

I have always used it this way:


Then I call glMatrixMode(GL_MODELVIEW);
And do all my drawing stuff, and it works just fine.

But recently I needed to include some Billboards in my app.
I noticed that in all the sample code I have seen about Billboards the gluLookAt function is used before calling glMatrixMode(GL_MODELVIEW);
and all the calculations to make the Billboard face the camera are done taking
the camera rotation from the Modelview Matrix , not the Projection Matrix

I changed all my code to work this way, but the problem now is that when I move the camera, the lights seem to move whit it, this was not happening before.

My question is, where is the right place to
call gluLook at , Projection or ModelView matrix ?


If you put the gluLookAt matrix in the Projection matrix, your specular lighting (which you probably haven’t used, or you didn’t notice this problem) would not come out correctly.

To keep your lights in world space (ie, not camera relative), call you light setup routine after you put the gluLookAt matrix on the modelview matrix stack.

further info

Thank you guys !!
Everything is working just right now.
And yes the specular lighting was very bad, now I can notice the difference.