PDA

View Full Version : Odd problem with lights



prekipik
03-26-2001, 12:00 AM
Hi guys,

I'm beginning in OpenGL, and I've done a simple display program using glut, in which you can freely move.

But the problem is that when I turn, the lights seem to turn with me, so the lighting becomes bad.

To get an idea : http://prekipik.free.fr/gluttest.zip
then 'make glut', then try to turn using '7' and '9' on the numeric keypad.

Thank you.

Bob
03-26-2001, 01:28 AM
You need to set light position after you set the modelview matrix. This is because that the light position is multiplied with the modelview matrix. You probably set the position at startup or so.

prekipik
03-26-2001, 02:23 AM
Well, it works perfectly.
Thank you very much for your help.