Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Light source on random position in the world

  1. #1
    Intern Newbie
    Join Date
    Apr 2012
    Posts
    43

    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 ?

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,894
    Look at the MODELVIEW active when you register the light source position and direction. That positions the light source.

  3. #3
    Intern Newbie
    Join Date
    Apr 2012
    Posts
    43
    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
    Last edited by artariel; 06-29-2012 at 08:40 PM.

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,894
    w=0 is a vector (directional light source). w=1 is a position (point light source).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •