PDA

View Full Version : how do i use Multitexturing & VertexArrays at same time?



MickeyMouse
03-15-2002, 03:16 AM
hi!
anyone knows how to make use of
GL_TEXTURE_COORD_ARRAY and multitexturing?

where do i set pointer to each unit coords when multitexturing?
and how do i draw them then?

till now (without multitexturing) i do like this:
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, sizeof(vert_t), &verts[0].tv);
glDrawArrays(GL_TRIANGLES, faces[0].first, 3);

thx for any help

nemesis
03-15-2002, 03:28 AM
Hi!

Using the GL_ARB_multitexture extension, you have to do something like this:

glVertexPointer (3, GL_FLOAT, sizeof(point), vertexArray);

glClientActiveTextureARB(GL_TEXTURE0_ARB);
glTexCoordPointer (2, GL_FLOAT, sizeof(texCoord), texCoords_1);

glClientActiveTextureARB(GL_TEXTURE1_ARB);
glTexCoordPointer (2, GL_FLOAT, sizeof(texCoord), texCoords_2);

glActiveTextureARB ( GL_TEXTURE0_ARB );
glBindTexture ( GL_TEXTURE_2D, glTextureID[0] );
glTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );

glActiveTextureARB ( GL_TEXTURE1_ARB );
glBindTexture ( GL_TEXTURE_2D, glTextureID[1] );
glTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );

glDrawElements(GL_TRIANGLES, numIndexs, GL_UNSIGNED_INT, indexs); // Or DrawArrays


Good luck!
-nemesis-

MickeyMouse
03-15-2002, 03:40 AM
ahaaa.... thx!