Archived

This topic is now archived and is closed to further replies.

Colombian

Vertex arrays

Recommended Posts

I am trying to implement vertex arrays. and I have a little problem. I got everything in thier respective array. Vtx , TexCoords, and Normals But The indices for the textures coordinates are different from the Vtx indices. So in my simple call to: glDrawElements(GL_TRIANGLES,It->mModel->mObjectList[0].mNumFaces * 3,GL_UNSIGNED_INT,It->mModel->mObjectList[0].mAllVtxIndices); it calls it with the wrong indices for the texcoord array. I have tried Disabling and enabling the arrays indepently and calling them with different set of indicies but it does not work //Here is that code glVertexPointer(3,GL_FLOAT,0,It->mWorldVtxList); glTexCoordPointer(3,GL_FLOAT,0,It->mModel- >mObjectList[0].mTexVtx); glDisableClientState(GL_VERTEX_ARRAY); glDrawElements(GL_TRIANGLES,It->mModel->mObjectList[0].mNumFaces * 3,GL_UNSIGNED_INT,It->mModel->mObjectList[0].mAllVtxIndices); glEnableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDrawElements(GL_TRIANGLES,It->mModel->mObjectList[0].mNumFaces * 3,GL_UNSIGNED_INT,It->mModel->mObjectList[0].mAllTexIndices); So here its my question, Is there any way to call glDrawElements when with two different set of indices , one for vtx and one for textcoords, and make it work fine? The texturesCoordinates and Vtxs Im reading from a .ASE file , so there is not much that I can do about their order? OK, Please help ? this has been bugging for quite some time now. Thanks in advance to all the replies.

Share this post


Link to post
Share on other sites
quote:
Original post by Colombian
So here its my question, Is there any way to call glDrawElements when with two different set of indices , one for vtx and one for textcoords, and make it work fine?


No.

You will have to reorder the tex-coords/vectors/etc so that you only need one set of indices. For example if three faces share a vertex, but they have different tex-coords, then you will have to create three instances of that vertex, each containing tex-coords for the appropriate face.

Share this post


Link to post
Share on other sites