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

Thread: Vertex Color with Light

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    10

    Vertex Color with Light

    Hi, I have a simple cube that has vertex colors and normals. With no lighting (lighting altogether disabled) the vertex colors show fine. With lighting turned on the vertex colors don't show.

    The lighting looks fine, but I thought it would 'add' to the vertex coloring, not remove it. Saying that, I haven't set up any material properties, could that be it?

    Thanks

    David

  2. #2
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,370

    Re: Vertex Color with Light

    Are you using any textures for your cube or in another part of your code?

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    10

    Re: Vertex Color with Light

    No not at all.

    Without the lights being enabled very little else is being done but definitely no textures, or texture coordinates - I haven't even set up any texture states.

  4. #4
    Intern Contributor Abdallah DIB's Avatar
    Join Date
    Feb 2009
    Location
    France
    Posts
    70

    Re: Vertex Color with Light

    with light u have to use color material glColorMaterial or glmaterial.
    color material define how ur materials or bodies will react under lights .
    with glColorMaterial u have to call glEnable(GL_COLOR_MATERIAL) then u change the current color using glColor.

    and also dont forget to enable the lighting !

  5. #5
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    10

    Re: Vertex Color with Light

    That's great thanks.

    So, just to confirm, vertex colors and lighting are mutually exclusive?

    [EDIT] Ignore this, misread previous post

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

    Re: Vertex Color with Light

    Not at all.

  7. #7
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    10

    Re: Vertex Color with Light

    Quote Originally Posted by ZbuffeR
    Not at all.
    My Bad! Sorry - didn't read the original reply properly. Yes he is right and they are now working together

Posting Permissions

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