PDA

View Full Version : Ase & vertex arrays



McZ
02-05-2003, 12:51 AM
I have made my own nice Object class that imports .Ase files exported by 3D Studio Max 2.5 but I have a problem with Texture coordinates when using vertex arrays

exampel:

glVertexPointer(...);
glNormalPointer(...);
glTexcoordPointer(...);

glEnableclientstate(...);

glDrawElements(...);

but it doesn't work the way I want.. becouse the texture will only show on the front and the back side of my cube..

but when I do this the texture shows on all sides..

for (loop through vertex indices)
{
glBegin(Triangle)
glTexcoord(TVertexList[TFaces[i].v[0]]);
glNormal(NormalList[Faces[i].v[0]]);
glVertex(VertexList[Faces[i].v[0]]);
...
glEnd();
}

how can I use the same index list for both vertex,normals and texture coordinates?? as far as I know the texture coordinates use a different index list.

JustHanging
02-05-2003, 03:28 AM
Hi,

If a vertex has multiple texture coordinates, you have to make copies of it so that there's only one pair of texture coordinates for each vertex. Then you can draw them with vertex arrays.

-Ilkka