MultiTexture and VBO

Thanks in advance for any help

I am having problems getting multitexture working with VBO (and without VBO). I have three textures - ShadowMap, DetailMap, and ColorMap. I am running on a Geforce 4600 which has 4 texture units.

Everything works fine with just the shadow map and either Just the Detail or Just the Color. When I enable a third texture, there seems to be no effect.

Here is some code snippets(the shadow map is already setup and bound to Texture0):

The Setup:
glActiveTextureARB(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);//T
glBindTexture(GL_TEXTURE_2D, m_Texture[0]);//T
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);//T

glActiveTextureARB(GL_TEXTURE2);
glEnable(GL_TEXTURE_2D);//T
glBindTexture(GL_TEXTURE_2D, m_Texture[1]);//T
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);//T

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);//T

The render:

glBindBufferARB_ptr(GL_ARRAY_BUFFER_ARB,buffID);
glVertexPointer(3,GL_FLOAT,0,BUFFER_OFFSET(offVert));
glNormalPointer(GL_FLOAT,0,BUFFER_OFFSET(offNorms));

glActiveTextureARB(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glClientActiveTextureARB(GL_TEXTURE1);
glTexCoordPointer(2,GL_FLOAT,0,BUFFER_OFFSET(offTex));

glActiveTextureARB(GL_TEXTURE2);
glEnable(GL_TEXTURE_2D);
glClientActiveTextureARB(GL_TEXTURE2);
glTexCoordPointer(2,GL_FLOAT,0,BUFFER_OFFSET(offTex));

glDrawElements(GL_TRIANGLES,numFaces[0],GL_UNSIGNED_INT,pFaces[0]);

As a troubleshooting step above, I am sending the same TexCoords to the second and third units. Ultimately, I have a different set of detail coords which I want to send to unit three, and they don’t work either.

Thanks again for any help!

glEnableClientState(GL_TEXTURE_COORD_ARRAY) is per texcoord array. You need to do it after the respective glClientActiveTextureARB(GL_TEXTUREx) calls.

Thanks Relic!!!

That was just what I needed. You have no idea how much frustration you have just eliminated.

Thanks again!!!

:slight_smile: