Sign in to follow this  

Interleaved Array and MultiTexturing?

Recommended Posts

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this