Light source on random position in the world

Examples i have seen so far are always about lighting one object, when i tried to apply this on a terrain generator example, things were changed. I am setting a position for light, applying attenuation, calculating things but light source is like following me. Calculations are done according to the light position and gl_vertex position. but i’m like the light source. Can you share glsl lighting examples that contains some wide area instead of lighting one object ?

Look at the MODELVIEW active when you register the light source position and direction. That positions the light source.

i think the problem was about w coordinate of light. i have just set it to 1.0 and it seems to be static now :stuck_out_tongue:

edit: yep it works great. i dont know why w fixed it

w=0 is a vector (directional light source). w=1 is a position (point light source).

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.