PDA

View Full Version : glTexCoordPointer and multi texturing



PeterP
01-01-2003, 09:49 PM
Hi,

I wonder if I have found a driver bug.

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 on how to get this working appreciated!

Thanks,
Peter

Sancho
01-01-2003, 10:43 PM
What do you mean by

Originally posted by PeterP:
Then all the texture units reports "enabled" even though I only have numTexturesUsed = 1.

PeterP
01-02-2003, 01:19 AM
Thanks for taking the time.

In the first code section numTexturesUsed = 1.

In the second code section I loop though all four texture units (on my GeForce4).

I was expecting that the first texture unit should report "enabled" and the other three texture units should report "not enabled".

But instead all four texture units have texture coordinates enabled.

Asgard
01-02-2003, 03:26 AM
That's because your second piece of code is incorrect. Change it to this:



for (int i = 0; i < numTextureUnits; i++)
{
glClientActiveTexture(GL_TEXTURE0 + i);
int enabled = glIsEnabled(GL_TEXTURE_COORD_ARRAY);
}


and it'll work as expected.

PeterP
01-02-2003, 04:10 AM
Ah..

thanks!

pbrown
01-02-2003, 05:23 PM
By the way, if you think you've found a driver bug, it's helpful to mention the driver and hardware that you think has the bug.

In this case, it clearly isn't a driver bug, but in general that kind of information is good for those of us whose job it is to create driver bugs. :-)

Pat