Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Lighting doesn't work :(

  1. #1
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000

    Lighting doesn't work :(

    Well, my scene isn't lit at all (the polygons are rendered as if lighting was disabled), and i don't see what i'm missing.

    - lighting is activated,
    - i specify a normal for each vertex (the vector is already normalized),
    - i use a single light (GL_LIGHT1) using ambient and diffuse parameters,
    - the position of the light seems to be correct,
    - the material has been created,
    - i use GL_MODULATE when i bind the textures,
    - the model used is GL_SMOOTH.

    In addition i compiled another program which is using lighting and there is no problem. It 's not a hardware/drivers problem..

    Any suggestion ?


  2. #2
    Member Regular Contributor
    Join Date
    Feb 2000
    milano, italy

    Re: Lighting doesn't work :(

    try to check if opengl has the correct lighting state by querying it with glGet...() functions.

    maybe you lost tracking of your application state...

    also check if some light has a negative value, or if the global ambient is also negative.

    is your appication multithreaded? if it is so, there is the chance the RC has not made current to a thread, and opengl discards commands when the RC is not current.


  3. #3
    Junior Member Newbie
    Join Date
    Apr 2000

    Re: Lighting doesn't work :(

    There is huge number of possible errors.
    (Posting parts of your code could help)

    It might sound stupid but did you call
    glEnable(GL_LIGHT1) prior to rendering the scene ?

    Also be careful about your lights geometry.
    Especially when setting directions and positions keep in mind that they are multiplied by the current modelview matrix and then stored in eye coordinates. So double check your light position setup.

    Call glGetError followed by gluErrorString to see if anything is wrong. Do so before and after rendering your scene these two commands can help you a lot.

  4. #4
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000

    Re: Lighting doesn't work :(

    Watch out at which point you set the lighting position (before or after the modelview matrix?)
    Binding texture for the first time needs more TexEnv states to be set. Default min filtering for example is GL_NEAREST_MIPMAP_LINEAR. Did you download mipmaps?

    [QUOTE]Originally posted by Ysaneya:
    [B]Well, my scene isn't lit at all (the polygons are rendered as if lighting was disabled), and i don't see what i'm missing.

    Any suggestion ?

Posting Permissions

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