View Full Version : How to blend vertex color with the material diffuse ?

07-17-2000, 08:40 PM
http://www.opengl.org/discussion_boards/ubb/smile.gifWell, the question is right in the body ! http://www.opengl.org/discussion_boards/ubb/smile.gif
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 ?

07-18-2000, 06:27 AM
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?

07-18-2000, 10:20 AM
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).]

07-18-2000, 10:59 AM
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 ! http://www.opengl.org/discussion_boards/ubb/smile.gif

Thanks for the answers !