light: Lighting moves with camera

In my scene the light keeps moving with the camera. I don’t really want this (rather useless really) and I’d like my lighting to be on a fixed position in the scene. How can I accomplish this?

I set the light properties in the init of the scene and use GLUlookat to set my camera view.

You have to set the light position after you have set the viewpoint transform.

Originally posted by Bob:
You have to set the light position after you have set the viewpoint transform.

TY

I called glLightFv after the glulookat now in the render function and it seems to work
But what I’m wondering about is WHY it works… isn’t the light position affected by the rotation of the axis system?

Yes, the light position is transformed by the modelview matrix.

i believe all matrix operations happen in the reverse order that you specify, or something like that…

glRotatef(90, 1, 0, 0);
glTranslatef(10, 0, 0);

i think the translate will get matrixed (is this a word?!?) in first, then the call to rotate. i’m kinda sketchy on the details but i know i’ve seen this discussed here before.

jebus

[This message has been edited by jebus (edited 11-25-2002).]

I’m 99.9% sure it works now… I had a bit of a blurry moment so I thought that the light SHOULD be affected by the glulookat in another way (monday, morning, hangover, you know the effects).