View Full Version : Light source on random position in the world
artariel
06-29-2012, 09:48 AM
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 ?
Dark Photon
06-29-2012, 02:31 PM
Look at the MODELVIEW active when you register the light source position and direction. That positions the light source.
artariel
06-29-2012, 08:28 PM
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 :P
edit: yep it works great. i dont know why w fixed it
Dark Photon
06-30-2012, 07:07 AM
w=0 is a vector (directional light source). w=1 is a position (point light source).
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.