Hello I’m trying to get multiple textures on the same big multi-polygon surface in openGL. to do this I use the glActiveTextureARB and glClientActiveTextureARB to set the texture (just 2 different textures I use, texture and focusedTexture), and set their correct coordinates and enable everything. After I set these up I call a lot of glDrawElements() to draw a surface.
However, the surface only has the LATTER texture that was enabled!
//excerpt of code
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, focusedTexture);
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, focusedTexCoords);
then I call
//excerpt of code
glBindBufferARB(GL_ARRAY_BUFFER_ARB, cVboId);
glColorPointer(3, GL_FLOAT, 0, 0);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, nVboId);
glNormalPointer(GL_FLOAT, 0, 0);
then I have a for loop that calls a lot of times: glDrawElements(GL_QUAD_STRIP, 2*maxXres, GL_UNSIGNED_INT, quadIndices[i5]);
I even made a hotkey for debugging that switches between three states: case 1 tries to render both, case 2 tries to render texture only, case 3 tries to render focusedTexture only. Cases 2 and 3 both work but Case 1 only does whatever texture is enabled last (in this instance, focusedTexture). Help please.
edit: i also tried changing the modes of the GL_TEXTURE_ENV to GL_INCR or GL_ADD or GL_MODULATE to make sure it’s not just hidden behind the other texture, and still it doesn’t show up.