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: GL_Lighting and vertex colors

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2017
    Posts
    11

    GL_Lighting and vertex colors

    I am trying to introduce GL_LIGHTING into a scene, but it apparently overwrites the predefined colors assigned to the vertices, instead relying on the material functions exclusively. What should be done to combine "baked" vertex lighting values with the dynamic lighting efficiently?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,472
    Quote Originally Posted by silikone View Post
    I am trying to introduce GL_LIGHTING into a scene, but it apparently overwrites the predefined colors assigned to the vertices, instead relying on the material functions exclusively. What should be done to combine "baked" vertex lighting values with the dynamic lighting efficiently?
    You can use glColorMaterial() to take one or more of the material colours from the vertex colour. If you want anything more complex, you'll probably need to abandon fixed-function lighting in favour of shaders.

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2017
    Posts
    11
    Doing that, I suppose the material could be either ambience or emission, though is there a practical difference between these two material components if the ambient light level is always 1?

    Yeah, shaders are indeed a panacea, but I want to make something that can run on hardware of the last millennium just for good measure.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,472
    Quote Originally Posted by silikone View Post
    Doing that, I suppose the material could be either ambience or emission, though is there a practical difference between these two material components if the ambient light level is always 1?
    No. In that situation, both of those colours will be added to the final vertex colour.

Posting Permissions

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