ARGH!
I''m trying to do a simple multitexturing test but it doesn''t work as I want it to!
I set up my two color arrays this way:
// SETUP COLOR ARRAYS
color1[ctr][0] = 1; // RED
color1[ctr][1] = 0;
color1[ctr][2] = 0;
color2[ctr][0] = 0; // GREEN
color2[ctr][1] = 1;
color2[ctr][2] = 0;
Then I enable two texture-units:
// THE VERTEX ARRAY
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, terrain);
// TEXTURE UNIT 1
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glTexCoordPointer( 2, GL_FLOAT, 0, texcoords );
glColorPointer( 4, GL_FLOAT, 0, color1 ); // COLOR1
// TEXTURE UNIT 2
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer( 2, GL_FLOAT, 0, texcoords );
glColorPointer( 4, GL_FLOAT, 0, color2 ); // COLOR2
// TexUnit1 shut up
glActiveTextureARB( GL_TEXTURE1_ARB );
glDisable( GL_TEXTURE_2D);
Then I draw my object, using texture-unit 0 ONLY !!!
glActiveTextureARB( GL_TEXTURE0_ARB );
glEnable( GL_TEXTURE_2D);
myTexMan.Bind(tex1);
for (int z = 0; z < 5-1; z++)
{
glDrawElements(GL_TRIANGLE_STRIP, 10, GL_UNSIGNED_INT, &indices[z * 5 * 2]);
}// end for
What I expect? That the texture is RED because I set color1 to 1,0,0 and TextureUnit0 uses only this
array.
But the image is GREEN!!! Why? I didn''t use the second textureunit so it shouldn''t affect anything....
Thanks, vK