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 5 of 5

Thread: Ambient lighting question

Hybrid View

  1. #1
    Newbie Newbie
    Join Date
    Oct 2012
    Posts
    3

    Question Ambient lighting question

    I'm trying to use Light0 to light a simple scene. The scene is being lit, but polys which are facing away from the light are very dark. I tried setting the GL_AMBIENT value for light0 to something brighter than the default to correct this, however, it doesn't seem to have any effect. The polys facing away from the light are still very dark. Is there a trick to this?

  2. #2
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,947
    You need to set the material ambient color to the desired value (probably just make it match your diffuse color). It's a bit redundant but it gives you more independent control of limited non physical lighting.

  3. #3
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,947
    Note that this is all legacy functionality and you should try to progress to shaders when you are able.
    Last edited by dorbie; 10-24-2012 at 03:54 PM. Reason: typo

  4. #4
    Newbie Newbie
    Join Date
    Oct 2012
    Posts
    3
    I'd love to use shaders. However, I'm writing for the lowest common denominator. My app is eventually going to be ported over to Android platforms and I'm not sure if Android supports shaders in openGL ES.

  5. #5
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,947
    Any Android platform you care about has first class support for OpenGL ES 2.0 which is shaders only, no fixed function.

    There is OpenGL ES 1.1 support usually through backwards compatability where the driver uses shaders for the fixed function pipeline you set up.

    You should go with shaders for Android, and install Google's Angle API to develop for OpenGL ES on the desktop accross cards if Android is your target.

    OpenGL desktop shaders are slightly different with more functionality and different keywords than OpenGL ES. Some of these changes are cosmetic. If you get Angle and code on it you know you will be writing portable code. It is shader based though :-)

Posting Permissions

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