PDA

View Full Version : VA + Multitexture Question



Old GLman
04-23-2002, 06:43 PM
Hello,

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

Omaha
04-23-2002, 06:54 PM
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.

Old GLman
04-23-2002, 07:22 PM
Hi,

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.

EDIT:

Hi,

I did some more digging. This (http://www.berkelium.com/OpenGL/GDC99/multitexture.html) 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).]

Omaha
04-24-2002, 07:07 PM
I imagine so.

/me shields face from imminent counter-argument

Robbo
04-25-2002, 12:47 AM
Yes - you can use the same set of texture coords for both texture units.

nemesis
04-25-2002, 01:52 AM
Hello!

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);

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

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

// Activate the textures
glActiveTextureARB ( GL_TEXTURE0_ARB );
glBindTexture(GL_TEXTURE_2D,glTextureID[i]);

glActiveTextureARB ( GL_TEXTURE1_ARB );
glBindTexture(GL_TEXTURE_2D,glTextureID[j]);

// DRAW...

-nemesis-

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