TexGen + TexCoordPointer

I was doing some tests, and since the model (drawn with glDrawElements) appeared all black, I decided to try glTexGen with sphere_map to see if the texture was loaded OK and the texture ID was valid too.

It crashed because I had
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

When I disable that, the texture appears fine. Am I crazy, or is texture coordinates supplied by client suppose to be ignored, when TexGen is enabled (for S and T)

V-man

Well I’d say you found a bug, but I’m no spec monkey.

I expect your conclusions are correct, but the worst thing that should happen even if you are wrong is a gl error gets generated.

[This message has been edited by dorbie (edited 06-09-2002).]

I suspect the crash is because you have your tex coord pointer pointing to an invalid memory block. Of course, one would assume that with texgen enabled the driver wouldnt even bother trying to look at the tex coord array, but thats beyond the point. Once you go and do something silly, there is no point in blaming the driver for doing something silly too.

Good point, I assumed valid data.

The vertex data pusher (client state, if you will) doesn’t know much about texture coordinate generation, which is server side.

Thus, enabling texture coordinate arrays will still send texture coordinates to the card, no matter whether texgen is on or not. Seems quite natural (according to the spec) to me.

Enabling texture coordinate arrays without a valid array established is also likely to crash; that seems natural too :slight_smile:

FYI, the same thing happens with an invalid texcoord pointer and an enabled texcoord array client state on a disabled texture unit. Just make sure you always disable the arrays not explicitly used.

OK, I guess disabling is essential. Either that or you must suply a valid pointer.

Thanks guys,
V-man