   Multi-Texturing Problem
  I tried to use multi-texturing but for some reason I can't get it to work. I made sure that I support the extension and how many texture units I support( which is 4). I've followed many tutorials but I can't get it to work like I missing something but I have no clue what. The only texture that shows up is the one that was called last (using glBindTexture) regardless of active texture unit.I use the devIL image library to load my images and it works great so I know that library is not the problem.This is what I have trying to combine 2 textures...[source lang="cpp"}#include "OGL.h"OGL::OGL(){}OGL::~OGL(){    glDeleteTextures(1, &tId);    ilDeleteImages(1, &iId);    glDeleteTextures(1, &tId2);    ilDeleteImages(1, &iId2);}void OGL::init(){{//DevIL Used    ///Load Textures    glEnable(GL_TEXTURE_2D);    glEnable( GL_ALPHA_TEST );    glAlphaFunc(GL_GREATER, 0.0);    ilInit();    ilGenImages(1, &iId);    ilGenImages(1, &iId2);    ilBindImage(iId);    ilLoadImage("./test.png");    iData = ilGetData();    w = ilGetInteger(IL_IMAGE_WIDTH);    h = ilGetInteger(IL_IMAGE_HEIGHT);    glEnable( GL_TEXTURE_2D );    glEnable(GL_TEXTURE_2D);    glGenTextures(1, &tId);    glBindTexture(GL_TEXTURE_2D, tId);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, iData);    ///    ilBindImage(iId2);    ilLoadImage("./test2.png");    iData = ilGetData();    w = ilGetInteger(IL_IMAGE_WIDTH);    h = ilGetInteger(IL_IMAGE_HEIGHT);    glGenTextures(1, &tId2);    glBindTexture(GL_TEXTURE_2D, tId2);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, iData);}///Set texture units   glActiveTextureARB(GL_TEXTURE0_ARB );    glEnable(GL_TEXTURE_2D);    glBindTexture(GL_TEXTURE_2D, tId);    glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);    glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE);    glActiveTextureARB(GL_TEXTURE1_ARB );    glEnable(GL_TEXTURE_2D);    glBindTexture(GL_TEXTURE_2D, tId2);    glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);    glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_INCR);    glActiveTextureARB(GL_TEXTURE0_ARB);}void OGL::draw(float t){    //Clear Background    glClear(GL_COLOR_BUFFER_BIT);    glMatrixMode( GL_MODELVIEW );    glLoadIdentity();    glBindTexture(GL_TEXTURE_2D, tId);    glPushMatrix();    glBegin(GL_TRIANGLES);    glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f,   1.0f);    glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f,   1.0f); glVertex2f(0.0f,   1.0f);    glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.87f,  -0.5f);    glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.87f,  -0.5f); glVertex2f(0.87f,  -0.5f);    glMultiTexCoord2fARB(GL_TEXTURE0_ARB, -0.87f,  -0.5f);    glMultiTexCoord2fARB(GL_TEXTURE1_ARB, -0.87f,  -0.5f); glVertex2f(-0.87f, -0.5f);    glEnd();    glPopMatrix();    glFlush();}
  I think you will want to enable blend mode and setting some reasonable blend function - I don't see anything obviously wrong so I suspect you're actually getting both textures, but they are not being combined. By the way, why do you have negative texture coordinates? Usually they are clamped between 0 and 1.   ;  In thisglTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_INCR);GL_INCR is not valid.If you need some exampleshttp://www.opengl.org/wiki/Texture_Combiners;  oops, sorry I didn't notice that I had another post because gamedev was running so slow that I didn't think the post went through. Thanks for the suggestions though.About the texcoords I figured you could think of them as being on an xy grid which in this case is not a problem since it still worked but I get what your saying. I also did it just to do a quick test to see if I could get the multi texturing to work because the multi-tex shader I made was not doing what I expected.It Worked! Now to try the same thing with my shader.[Edited by - Asem on June 9, 2009 4:31:45 AM]