glColor with multi-texture / texture combiners

I am using multi-texturing and texture combiners to apply terrain overlays with a blending mask:


//render base texture
...

//render overlay texture
glActiveTextureARB(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, m_pOverlayMask->GetTextureID());


glActiveTextureARB(GL_TEXTURE1);

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, m_pOverlayImage->GetTextureID());
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);

glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE1);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, m_bInvertOverlayMask ? GL_ONE_MINUS_SRC_ALPHA : GL_SRC_ALPHA);

//calculate tex coords and send verts
...

It works fine except that I’m trying to add the ability to modulate the color components of the overlay image and the alpha of the overlay blend mask.
Normal use of GlColor seems to have no effect. I have also tried

glTexEnvf(GL_TEXTURE_ENV, GL_ALPHA_SCALE, m_nMaskAlpha);

and

float fRGBA[4];
fRGBA[0] = m_OverlayColor.r;
fRGBA[1] = m_OverlayColor.g;
fRGBA[2] = m_OverlayColor.b;
fRGBA[3] = m_OverlayColor.a;
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, fRGBA);

But neither of those seem to have any effect at all. Is what I’m trying to do possible without shaders (I’m targeting legacy hardware) or do multi-texturing and texture combiners just ignore color biases?
Thanks for any info.

You’ve set GL_REPLACE, so it’s doing exactly that.

I set GL_REPLACE, but that’s what I want the texture overlay to do- replace what’s underneath it. And it works fine. I just can’t get it to be effected by GlColor as I can when I’m not multi-texturing. Here’s an image of what I’m doing:

Again, this works fine. I’m just trying to apply glColor to the overlay (water). I can apply it to the base texture (grass) fine since I’m rendering it “normally” with a single texture.

glcolor only applies to “before-first-texture” stage.
So if you revers the texture stages order, it can be fine :
glcolor modulated by water modulated by (grass * alpha gradient)

GL_REPLACE ignores glColor, by definition.

If you want to modulate the texture value with glColor, use GL_MODULATE, with the texture and primary color as inputs.