I’m setting up two texture coord arrays in opengl for texture units one and two. I do this with glClientActiveTextureARB.
With one unit everything works fine. My initial texture displays with the proper texture coords. However, when I enable unit two rather than displaying the new texture with the first, the first is displayed again with the coords in the second texture coordinate array. I can’t seem to get the second texture to display at all.
I’m sure my units are set up right because the texturing works fine in immediate mode. Below is the code I use to set up the texture arrays :
The third parameter in glTexCoordPointer is the stride. That is, the byte offset between consecutive array elements. You probably should pass 0 as the stride. That means the array is tightly packed.
-SirKnight
[This message has been edited by SirKnight (edited 06-25-2003).]
The array is called vertexList which is an array of a struct I have called terrainVertex. In terrainVertex I store a vertex position (three floats) and two texture coords (two floats each).
Out of desperation, I tried 0 and (as I expected) it yielded completely bogus results.
That said, thanks for the suggestion. This glitch is halting development on my project and I have a deadline coming up. I really need to figure out whats wrong. If anyone can help please feel free to suggest something.
I’m not really an expert in all this so I made a simple test app using your code that you posted. I loaded up two textures, set up the client vertex array, used your code shown, and then used glDrawElements() to display my image.
It works fine.
Without knowing more, I am assuming the problem lays somewhere else. ie: Currently the only way I could get this particular code to have the “first” texture to appear using the second set of texture coordinates - was to use a texture id of zero for the first unit, then the “first” texture number for the 2nd stage. Not saying that this is your problem though.
The more I work with this, the more I’m starting to think its a driver problem. --Of course I’ve blamed things on the driver or compiler in the past and ALWAYS find that it is infact my fault. So, I dunno.
I’m going to keep working though. Thanks for the help.