I'm trying to use multitexturing in my program but I'm hopelessly lost... Help!!!
I have written a basic fragment shader which declares two uniform sampler2D variables.
uniform sampler2D tex1; uniform sampler2D tex2; ... t1 = texture2D(tex1, texCoord1); t2 = texture2D(tex2, texCoord2);
My opengl display function does something like:
glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, tex1); glEnable(GL_TEXTURE_2D); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, tex0); glEnable(GL_TEXTURE_2D) ... glClientActiveTexture(GL_TEXTURE0); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, 32, buffer0); glClientActiveTexture(GL_TEXTURE1); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, 32, buffer1);
No matter what I do, it seems that in my shader the two uniforms point to the same texture object! I think the call to glBindTexture is wrong... Could you help me understand this?
Thanks a bunch!