Jump to content
  • Advertisement
Sign in to follow this  

Interleaved Array and MultiTexturing?

This topic is 3767 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i was wondering how to use multitexturing in one pass using interleaved array... Is that possible?

Share this post

Link to post
Share on other sites
USe it just like you use it with separate arrays, but make sure you get the stride parameter correct. That is, set vertex pointer, normal pointer, color pointer and whatever you use, just like you do with separate arrays. Then active each client side texture unit and specify the texture coordinates.

An example. myvertex is a structure with posiito, normal and two sets of texture coordinates. Vertex and normals are specified as usual, and texture coordinates are specified for each of the two texture units. The stride is the size of the vertex structure.

struct myvertex
float pos[3];
float norm[3];
float texcoord1[2];
float texcoord2[2];
} mydata[...];

glVertexPointer(3, GL_FLOAT, sizeof(myvertex), &mydata[0].pos);
glNormalPointer(GL_FLOAT, sizeof(myvertex), &mydata[0].norm);

glTexCoordPointer(2, GL_FLOAT, sizeof(myvertex), &mydata[0].texcoord1);

glTexCoordPointer(2, GL_FLOAT, sizeof(myvertex), &mydata[0].texcoord2);

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!