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.