PDA

View Full Version : Multitexturing problems



rgreene
06-05-2002, 01:22 PM
I'm having trouble getting my multitexturing code working, and I am pretty sure it is due to texture coordinates not being set correctly.

Here's a summary of what the code does:
glActiveTextureARB (GL_TEXTURE0_ARB);
glBindTexture (GL_TEXTURE_2D, fTexID0);
glEnable (GL_TEXTURE_2D);
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer (2, GL_FLOAT, 2 * sizeof (float), fCoordBuffer);
glActiveTextureARB (GL_TEXTURE1_ARB);
glBindTexture (GL_TEXTURE_2D, fTexID1);
glEnable (GL_TEXTURE_2D);
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer (2, GL_FLOAT, 2 * sizeof (float), fCoordBuffer);
glActiveTextureARB (GL_TEXTURE2_ARB);
glBindTexture (GL_TEXTURE_2D, fTexID2);
glEnable (GL_TEXTURE_2D);
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer (2, GL_FLOAT, 2 * sizeof (float), fCoordBuffer);
glActiveTextureARB (GL_TEXTURE3_ARB);
glBindTexture (GL_TEXTURE_2D, fTexID3);
glEnable (GL_TEXTURE_2D);
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer (2, GL_FLOAT, 2 * sizeof (float), fCoordBuffer);

I'm not sure if I need to call glEnableClientState (GL_TEXTURE_COORD_ARRAY); each time I change texture units, but either way it doesn't seem to be working. I've also tried duplicating fCoordBuffer 4 times, and given each texture unit a diffrent pointer, but that doesn't seem to help either.

I suspect it's a problem with the texture coord buffer because when I use glMultiTexCoord2fARB () everything works correctly, so I know it's not a problem setting up my texture or initializing the proper extensions.

Thanks! http://www.opengl.org/discussion_boards/ubb/smile.gif

pleopard
06-05-2002, 06:16 PM
Hey man, I can't answer your question ... I have a similar problem. I doubt you will get an answer here though, try the advanced forum. I would like to follow the thread myself.

rgreene
06-05-2002, 06:20 PM
I figured it out. I need to call glClientActiveTextureARB () before I bind each texture coord buffer.