View Full Version : How to move the light position?

10-29-2003, 03:38 AM
How to move the light position in runtime?
I did the following:

glLightfv(GL_LIGHT0, GL_POSITION,AmbientLightPosition);

with the new value,but wheren't any effect.

How to update only the changes connected to lighting ?

10-29-2003, 05:27 AM
Light position is manipulated by the current modelview matrix. The position stays fixed if you update light positions outside a modelview matrix hierarchy, it will move with objects of you do it inside.

"Ambient" light has no direction and position.

If you set the w coordinate of the light position to 0.0 you get a directional light, if you set it to 1.0 you get a positional light (pointlight, spotlight).

And you have to redraw your whole scene, of course.

10-29-2003, 06:42 AM
Thanks a lot.It works now.

I'm confused - in many examples I saw defining of "AmbientLightPosition".Seems that meaning of this is general light source position.