View Full Version : how to use texture combiners?

11-25-2013, 02:02 PM

I am having a hard time finding good information about texture combiners. Can they be used to draw a texture half-transparently? The texture already has its own alpha mask which defines its shape. But I want to draw the whole thing at a specifiable level of transparency.

I know that ordinarily you would use glColor and blend mode to do this. But it isn't working, and I am wondering if I have my combiner set up incorrectly.

It's really unclear to me what the relationship is between the blending mode setting and the combiner settings. Is there a good reference for learning about that?


11-25-2013, 05:19 PM
There's no relationship between the combine state and the blending state; the output of the per-fragment stage (set via the combiner mode) is used as input to the blending stage (set via the blend mode) (potentially after going through some other tests which don't really concern us here) so all that the blend stage needs is some form of input; it doesn't really care about what kind of states were used to get that input.

In your case, glColor (1, 1, 1, 0.5) with an old-fashioned TexEnv of GL_MODULATE (i.e. no combines needed) will get you an output from the per-fragment stage that contains alpha 0.5. Then setting up a glBlendFunc of (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), together with glEnable (GL_BLEND) (of course) should be all you need.

I'm curious what you mean by "it isn't working" here. You really should post some code so that we can help you properly because this is something that should work.

It's also the case that if you're talking about using GL_COMBINE modes, you're really at the stage where you should be seriously considering shaders instead.