   Texture Combiner Not Working
  I have a texture to display, along with an RGB texture to be used as an alpha map. I'd like to combine the 2 textures and have parts of the original texture be transparent. You get the point. Anyway, here's the code:glActiveTextureARB(GL_TEXTURE0_ARB);glClientActiveTextureARB(GL_TEXTURE0_ARB);glTexCoordPointer(2, GL_FLOAT, 0, terrain->texCoords);glEnable(GL_TEXTURE_2D);glBindTexture(GL_TEXTURE_2D, textureManager->textures[textureManager->getTextureIndex("data/grass.png")]);glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);glClientActiveTextureARB(GL_TEXTURE1_ARB);glTexCoordPointer(2, GL_FLOAT, 0, terrain->alphaTexCoords);glEnableClientState(GL_TEXTURE_COORD_ARRAY);glEnable(GL_TEXTURE_2D);glBindTexture(GL_TEXTURE_2D, textureManager->textures[terrain->terrainChunks->alphaIndices[0]]);glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);I'm getting solid white when I render. I'm not entirely sure of what I'm doing with the texture environment stuff, so some help would be much appreciated.Thanks,Jake   
  Right now the way you have it setup, each fragment has the rgb of texture0 and alpha of texture1. I assume that is what you wanted?The next thing is after you have that, you'll probably want to have an alpha test to discard fragments with a low alpha value, or maybe an alpha based blending function. Since it isn't in the code you posted, do you have it in there?   ;  Yeah, I'm using:glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);I have a different alpha map for 2 or 3 textures that I will do this for in attempt to splat the terrain. like I said, I get all white. There's a possibility that it might have to do with the texture coordinates, but it doesn't seem like I'd get white if it were that.;  That's OK, and also remember to enable blending (if you haven't already).The next thing is: you mentioned that the alpha map is a RGB texture. What is the GL internal format (3rd param to glTexImage2D)? Make sure it's something that has an alpha channel, because that's what you are extracting in your combiner function.   ;  So, when I actually create the alpha RGB texture I need to use something like GL_RGBA? Right now I don't, so I'll give that a try.  Thanks for all the help, by the way.;  I was trying to do the exact same thing a few months ago.  I posted my code here: http://www.gamedev.net/community/forums/topic.asp?topic_id=372568.Hope you find it useful.   ;  OK. The code you gave me behaves differently than what I was experiencing, but it still isn't right. When I include the code at the end where you go throught the textures and disable everything, I get solid white rendering.  I don't know why.  But when I comment out all that disabling code, the first rendered frame is solid white, then all subsequent frames it draws my alpha texture. Here's the complete rendering code:glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glLoadIdentity();glRotatef(xRot, 1.0, 0.0, 0.0);glRotatef(yRot, 0.0, 1.0, 0.0);glTranslatef(-camX, -camY, -camZ);glEnable(GL_BLEND);glActiveTextureARB(GL_TEXTURE0_ARB);glEnable(GL_TEXTURE_2D);glBindTexture(GL_TEXTURE_2D, textureManager->textures[terrain->terrainChunks->alphaIndices[0]]);glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE0);glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);glClientActiveTextureARB(GL_TEXTURE0_ARB);glTexCoordPointer(2, GL_FLOAT, 0, terrain->alphaTexCoords);glEnableClientState(GL_TEXTURE_COORD_ARRAY);glActiveTextureARB(GL_TEXTURE1_ARB);glEnable(GL_TEXTURE_2D);glBindTexture(GL_TEXTURE_2D, textureManager->textures[textureManager->getTextureIndex("data/grass.png")]);glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE1);glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE1);glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS);glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_PREVIOUS);glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA);glClientActiveTextureARB(GL_TEXTURE1_ARB);glTexCoordPointer(2, GL_FLOAT, 0, terrain->texCoords);glEnableClientState(GL_TEXTURE_COORD_ARRAY);glEnableClientState(GL_VERTEX_ARRAY);glVertexPointer(3, GL_FLOAT, 0, terrain->vertices);glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);glDrawElements(GL_TRIANGLES, terrain->mipMaps->triangleVertexNum, GL_UNSIGNED_INT, terrain->mipMaps->triangleIndices);/*glDisableClientState(GL_VERTEX_ARRAY);glActiveTextureARB(GL_TEXTURE1_ARB);glBindTexture(GL_TEXTURE_2D, NULL);glDisable(GL_TEXTURE_2D);glClientActiveTextureARB(GL_TEXTURE1_ARB);glDisableClientState(GL_TEXTURE_COORD_ARRAY);glActiveTextureARB(GL_TEXTURE0_ARB);glBindTexture(GL_TEXTURE_2D, NULL);glDisable(GL_TEXTURE_2D);glClientActiveTextureARB(GL_TEXTURE0_ARB);glDisableClientState(GL_TEXTURE_COORD_ARRAY);*/glDisable(GL_BLEND);Can anybody see what's wrong with this, or possibly know why I am getting the weird behaviour?  I just don't understand why it draws different things on different frames.   