PDA

View Full Version : gl Light Source follows the camera



Itun.itu
04-06-2011, 12:58 PM
Guys, how can this be. But in my previous projects, it wasn`t. And I don`t know how I attempt this effect. Tell me the truth, please.

Dark Photon
04-06-2011, 08:14 PM
You didn't give us much to go on. Fortunately this is a common mistake.

When you specify the light source position and direction, your MODELVIEW needs to be set to position the light source. Then when rendering the scene, you need to set MODELVIEW to the matrix used to transform those objects into the world.

Sounds like you are specifying the light source position/direction while your camera's viewing transform is in MODELVIEW, rather than your light's modelview transform.