I've implemented a scene using 3 quads, A, B, and C. Quad C is behind quad B. Quad B sits on top of Quad A.
All quads are using the same texture with the exception of Quad B. Quad B makes use of an alpha map and the base texture all the other Quads are using.
The code sample below is how I'm drawing Quad B with fixed function multi-texturing.
GLuint alphaGLTexture;
SDL_SurfaceToGLTexture(aTexture, &alphaGLTexture);
GLuint baseGLTexture;
SDL_SurfaceToGLTexture(baseTexture, &baseGLTexture);
glActiveTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
glBindTexture (GL_TEXTURE_2D, alphaGLTexture);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, baseGLTexture);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTranslatef(0.0f, 0.0f, 0.0f);
double u_coord = 0.0f, v_coord = 0.0f;
// Renders Quad B
glActiveTexture(GL_TEXTURE0)
glBegin(GL_QUADS);
// remainder of code modifies u_coord, v_coord and draws the other glVertex3f's.
glMultiTexCoord2f(GL_TEXTURE0, u_coord, v_coord);
glMultiTexCoord2f(GL_TEXTURE1, u_coord, v_coord);
glVertex3f(posax, posay, posaz);
When I apply a multitextured alpha map to Quad B, the textured Quads A and C change color and end up darker than Quad B.
When I remove any mention to GL_TEXTURE1 everything renders nicely, no dimming, though I lose my alpha mapping on Quad B.
Any recommendations or tips? Is there something wrong with my glTexEnvi calls?