PDA

View Full Version : glInterleavedArrays with Multitexturing?



Neals Shnyder
03-24-2001, 08:30 AM
Hello there,

I'm trying to find a method to draw my geometry in a faster way. Currently, I draw all through several calls to glColor4f, glNormal4f, glVertex3f, .... and so on. My
problem: I use multitexturing an i also call the function glMultiTexCoord2fARB. Has anyone an idea to draw my geometry faster? Another problem is that the texture u v coordinates can change :-/.

Any ideas?

thx,
Neals

Dodger
03-24-2001, 11:45 AM
You can use multitexturing with vertex arrays by sending the pointers to the appropriate texture unit:

glActiveTextureARB(GL_TEXTURE0_ARB);
glInterleavedArrays(GL_N3F_V3F, 0, &vertArray[0]);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, &texArray[0]);
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_FLOAT, 0, &colArray[0]);

glClientActiveTextureARB(GL_TEXTURE1_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, &texArray2[0]);

The vertex pointer is always the same for both texture units, and I believe so is the color pointer. The texture coordinate pointer can be set on different addresses for each texture unit.

Hope that helped http://www.opengl.org/discussion_boards/ubb/smile.gif