Results 1 to 6 of 6

Thread: Enable/Disable Lighting or Light0?

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2000
    Location
    Daytona Beach, Florida, USA
    Posts
    4

    Enable/Disable Lighting or Light0?

    When enabling/disabling lighting with one light, is it proper to enable/disable GL_Light0 as well as GL_Lighting, or instead of? When you leave lighting enabled and light0 disabled, is there an unnecessary performance cost for parts of the scene that don't need lighting (bitmaps, flat shapes, etc)?

    Thanks!

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Portsmouth, Hampshire, England
    Posts
    926

    Re: Enable/Disable Lighting or Light0?

    Lighting, means tell gl to use lighting calculations in the render pipline.

    LIGHT0, is a definition of a light implementation. i.e. type of light, position, color, attenuation etc. etc..

    GL allows for 8 lights, GL_LIGHT0, to GL_LIGHT7.

    To use 1 light, you can use any one of these. They need enabling also for their values to be used.

    need to do this IIRC

    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);

    //setup light 0.


    Nutty

  3. #3
    Senior Member Regular Contributor
    Join Date
    Aug 2000
    Posts
    118

    Re: Enable/Disable Lighting or Light0?

    Nutty, I think he wanted to know what is better to do if he doesnt need lighting to render something, to disable his lights, or to disable all lighting...

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Portsmouth, Hampshire, England
    Posts
    926

    Re: Enable/Disable Lighting or Light0?

    DOH! That'll teach me to answer questions on the ****!

    Probably disable GL_LIGHTING.

    Thats what I would do anyway.

    Nutty (****ed as a fart)

  5. #5
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: Enable/Disable Lighting or Light0?

    zed (sober unfortunately)
    not being a driver writer
    ild say this is better

    glDisable(GL_LIGHTING)

    than glDisable(GL_LIGHT0)
    i have a feeling with this way if lighting is enabled the driver will have to check what lights are enabled

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Enable/Disable Lighting or Light0?

    I agree that disabling GL_LIGHTING would be the way to go. If you were to just disabled GL_LIGHT0, you would disable all lights, but lighting would still be performed so everything would be dark! You'd then have to rely on the ambient lighting properties if you wanted to even see anything.
    Deiussum
    Software Engineer and OpenGL enthusiast

Similar Threads

  1. Lightning (enable/disable)
    By ei05tbe in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-11-2010, 03:40 PM
  2. Enable & Disable Lighting
    By JRGlide in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-08-2009, 09:43 AM
  3. enable/disable GL_COLOR_MATERIAL
    By jyoung77 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-27-2003, 05:25 AM
  4. Disable/Enable Perspective
    By gunsboy in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 03-24-2003, 12:35 PM
  5. FSAA enable/disable
    By V-man in forum OpenGL: General
    Replies: 6
    Last Post: 05-03-2001, 11:28 PM

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