glTexCoordPointer and multi texturing

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

What do you mean by

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

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.

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.

Ah…

thanks!

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. :slight_smile:

Pat