How to blend vertex color with the material diffuse ?

Well, the question is right in the body !
I’d like to blend (add or modulate) the material diffuse color with each vertex color (specified with a glColorPointer() list)…
Is it possible ??? Somebody can explain how to do ?

i could be wrong, but i was under the impression that glColor*() has no effect if GL_LIGHTING is enabled.

so, i would say no: you can’t blend the color and the material.

textures and materials can work together, though. maybe you could achieve the desired effect through clever texturing?

The glColor calls can replace the ambient or diffuse or both components of the material if you enable GL_COLOR_MATERIAL.

Is your question really to add or blend the material AND the colors?

Modulation can be done by a two pass algorithm rendering the first pass with the material and the second with color_material
and glBlendFunc(GL_DST_COLOR, GL_ZERO) and the full material brightness.

Adding the materials could be done with the same two passes and glBlendFunc(GL_ONE, GL_ONE), but that needs all materials and colors to be half bright.

[This message has been edited by Relic (edited 07-18-2000).]


That’s what I was affraid of…It’s not really possible using OpenGL…
Yes, I wanted to blend/add (in one pass) the vertex color AND the material diffuse…
And it sounds like it’s not possible…
Well, I’ll survive !

Thanks for the answers !