Color array overrides material alpha

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.

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.


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.

Good idea, I didn’t think about glSecondaryColorPointer().

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

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.