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: Problems with GL_LIGHTING

  1. #1
    Guest

    Problems with GL_LIGHTING

    WhenI enable the lighting, my object doesn t have any more colors. The problem lasts when I light the scene with white color (1,1,1) so it s not a problem of the lighting color.
    Could anyone please help me?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Feb 2000
    Posts
    148

    Re: Problems with GL_LIGHTING

    Your object is in grayscale?

    Did you define materials for your objects triangles too?..

  3. #3
    Intern Contributor
    Join Date
    Apr 2002
    Location
    Spain
    Posts
    66

    Re: Problems with GL_LIGHTING

    Originally posted by aaarg:
    WhenI enable the lighting, my object doesn t have any more colors.
    When you enable lighting, the color information is "thrown away". The only color data that OpenGL uses then is the material properties (ambient, diffuse, specular colors). To get a correct shading, also don't forget to specify vertex's normals.



    [This message has been edited by Azdo (edited 05-16-2002).]

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,096

    Re: Problems with GL_LIGHTING

    When you use lighting, the color is treated diffrently, maped like a material. You need to enable color under lighting, add this to your code before drawing anything: glEnable(GL_COLOR_MATERIAL);


    Originally posted by aaarg:
    WhenI enable the lighting, my object doesn t have any more colors. The problem lasts when I light the scene with white color (1,1,1) so it s not a problem of the lighting color.
    Could anyone please help me?

Posting Permissions

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