VA + Multitexture Question


I am having some trouble setting up multitexturing with my indexed vertex array. I found some previous posts on the board but the only one that was of any use I do not really understand. Can someone explain the procedure of setting it up? The example I found had two different arrays of texture coordinates. If my primitives are going to have the same texture coordinates for each texture, can I just set up all my textures for just one texture coordinate array? Thanks for your help.

Old GLman

This confused me at first. I haven’t done it yet, but the way I understand it (and please do correct me if I’m wrong)

you call glActiveTextureARB(…) (or whatever you use) to set your active texture unit, then you do glTexCoordPointer(…) as required.

Then, call glActiveTextureARB(…) to switch to the “next” texture unit, and call glTexCoordPointer(…) again, with the set of coordinates for the new texture level.

Lather, rinse, repeat as desired.


Thanks for your reply. If this is the case, and someone please point out if we are wrong, can I just have each texture unit point to the same array of texture coords? In my app there is no reason to have another set of texture coordinates when each set would be exactly the same.



I did some more digging. This article explains it pretty good. Also, you can have separate texture units pointing to the same texture coordinate array. Till next time!

Old GLman

[This message has been edited by Old GLman (edited 04-23-2002).]

I imagine so.

/me shields face from imminent counter-argument

Yes - you can use the same set of texture coords for both texture units.


Yes, you can certainly use the same cordinates array.
For example, you can do something like this:

// Define the arrays
glVertexPointer(3, GL_FLOAT, sizeof(Vector), vertexArray);

glTexCoordPointer (2, GL_FLOAT, sizeof(TexCoord), texCoordsArray);

glTexCoordPointer (2, GL_FLOAT, sizeof(TexCoord), texCoordsArray);

// Activate the textures
glActiveTextureARB ( GL_TEXTURE0_ARB );

glActiveTextureARB ( GL_TEXTURE1_ARB );

// DRAW…


[This message has been edited by nemesis (edited 04-25-2002).]