Results 1 to 4 of 4

Thread: Lighting doesn't work :(

  1. #1
    Senior 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
    Senior 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

    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 ?

Similar Threads

  1. Coloring Doesn't Work With Lighting?
    By Rome_Leader in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-03-2014, 10:09 AM
  2. Replies: 1
    Last Post: 05-01-2013, 09:37 PM
  3. Basic lighting doesn't work
    By BeingSimpler in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 10-18-2011, 05:14 AM
  4. Lighting used to work, but now it doesn't
    By 147-2 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-07-2003, 03:51 PM
  5. It doesn't work...
    By GunCraP in forum OpenGL: User Software
    Replies: 0
    Last Post: 01-03-2003, 01:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean