How to move the light position?

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 ?

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.

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.