Change transparency for RGBA texture on the fly


This is my first post here.
So hello all!

Well, this is my problem: I have a RGBA texture loaded in memory. His transparent pixels (alpha 0) do not show, and the others do show, as it is expected.

But I need to give a second transparency using a double value (from 0 to 1) so that when this value is 0, nothing should appear, and when it is 1, the colors should appear “normally”. In the case of a 0.5 value, all colors should appear blended 50%.

I have tried different combinations of glTexEnvi and glBlendFunc, but nothing works. I’m pretty sure this can be easily done, but I can’t find the way, so here I am asking for your help.

(Changing alpha values one by one is not solution because I need spped).

Thanks in advance!

If I understood well what you need, just change glColor4f(1,1,1,secondTransparency);

By default, texture is modulated with current color.