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

Thread: Lighting characters

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2007
    Posts
    20

    Lighting characters

    I am using glsphere and glucylinder to form a character and when I try to light the backside of it with the light the one next to them is holding the back does not light even though the lighting model is two side. Any ideas on how I can make the light the characters are carrying light the character next to them.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,575

    Re: Lighting characters

    Two sided lighting is only useful if your spheres and cylinder are open, so it must be something else.

    Be sure your light is glEnable before rendering each solid, and do not enable /disable it.

    Can you post a screenshot ? Your description of the problem is very hard to understand.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2007
    Posts
    20

    Re: Lighting characters

    I don't know how to put a screen shot up here but what happens is that when the robots face to the right their light shows up on the back of the robot next to them but when they face to the left the light does not show up on the robot next to them. How can I get the light to show up facing both ways?

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,575

    Re: Lighting characters

    A guess, you need to define the light as "local" instead of the default (global, like an infinitely far away light source) :
    glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);

    Read this for details :
    http://glprogramming.com/red/chapter05.html

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2007
    Posts
    20

    Re: Lighting characters

    Thank you I already have the lighting model set to local viewer so that can't be it.

  6. #6
    Junior Member Newbie
    Join Date
    Dec 2007
    Posts
    20

    Re: Lighting characters

    Does anyone know how I can get the light to act the same way no matter what way the light is facing?

Posting Permissions

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