PDA

View Full Version : glTexCoordPointer and multi texturing



PeterP
12-30-2002, 01:47 AM
Hi,

After reading a bit in the red book I came to the understanding that you should use:

for (int i = 0; i < numTexturesUsed; i++)
{
glClientActiveTexture(GL_TEXTURE0 + i);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, texCoordBuffer[i]);
}

To set up texture coordinate arrays in multitexturing.

But it seems like I have been mistaken...

The code doesn't work as intended and if I use:

int numTextureUnits = 1;
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &numTextureUnits);

for (int i = 0; i < numTextureUnits; i++)
{
glActiveTextureARB(GL_TEXTURE0_ARB + i);
int enabled = glIsEnabled(GL_TEXTURE_COORD_ARRAY),
}

Then all the texture units reports "enabled" even though I only have numTexturesUsed = 1.

Any help appreciated!

Thanks,
Peter

CraZeE
01-03-2003, 11:47 PM
[quote]int numTextureUnits = 1;
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &numTextureUnits);[quote]

although u've specified numTextureUnits as 1 during declaration, glGetIntegerv will overwrite it with any value the card reports. So if u're using a better gfx card with proper drivers, that call will usually return >1 (gf4 will be 4 i think).