PDA

View Full Version : GL_Lighting and vertex colors



silikone
10-23-2017, 08:52 AM
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?

GClements
10-23-2017, 01:09 PM
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.

silikone
10-24-2017, 02:45 AM
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.

GClements
10-24-2017, 03:08 AM
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.