Rotate the light source & Opengl Comands

Hello…

I have scene in opengl ( a world , buldings and shadows which are casting from a fixed light source ““float lightPosition[] = {-5000, 5000, 1600, 0.0f};””). If i move my light source along x axis for example, the shadows follows this transformation and it starts moving in relation to the light source which is right and it seems nice. Now i want to rotate the light source around a fixed point ( like an orbit around my world) with glRotate I guess, but when i do this the shadows stays still, according the originall light source.

How can achieve this?

I also found something on internet which is might helpfull. The following comands but i dont know how to turn them into code. PLZ help i have along time trying to make this right…

Set the view transform
Push the matrix stack
Set the model transform to update the light’s position
Set the light position //glLightfv(GL_LIGHT_POSITION,…)
Pop the matrix stack
Send down the scene or model geometry
Swap buffers.

How do you suppose to rotate a point in infinity around anything?

Before being aware of the problem, you have to understand homogeneous coordinates. Your “lightPosition” is actually not a position, but a vector. Namely, since the fourth coordinate is 0, the light source is in infinity. You actually have something that is called a directional light. The light beams are parallel and come from the direction (-25, 25, 8). If you need a positional light, the fourth coordinate should not be zero.

Besides that, it is important where you call glLightfv(GL_LIGHT_POSITION,…). If you want the transformations affect the light position, the position has to be set after those transformations.