View Full Version : Color array overrides material alpha

01-29-2007, 02:01 PM
I am implementing an auto-fade on both dynamic models (lit with gl vertex lights) and static meshes (lit with a pre-calculated color array).

It seems that when I specify a color array, this overrides the alpha fade I set with glcolor4f. How do I get around this? Obviously I don't want to poke the alpha value to every index in the color array.

01-29-2007, 04:57 PM
You have several options:
- use a shader and supply the alpha
- use a texture combiner and supply the alpha as a constant
- Use a constant in the blend equation.

01-30-2007, 05:33 AM

The problem is that immediate mode and arrays mode are the 2 GL programming paradigms, they "run" in parallel, and each color, met in array, does almost the same, as glColor4f() call.

I see the decision in specifying your color array as glSecondaryColorPointer() or any other vertex attribute you want, but in that case you should rewrite your vertex shaders to handle this correctly OR if you decide to use secondary color - then you can set-up combiners in such a way to get RGB from secondary and A from primary.

01-30-2007, 07:52 AM
Good idea, I didn't think about glSecondaryColorPointer().

I'm trying to implement effects first on the ff pipeline, then emulate it in shaders.

02-06-2007, 11:46 AM
For anyone else who runs into this problem, I was able to solve it by setting the texture color and using GL_CONSTANT_ARB in the combiner.