Original Post
hi all , i'm writting a 3DStudio file parser but i can't figure out a problem with the UV Map. here is pseudo code of what i do (i ommit a large portion for clarity) : Finally i render the model with OpenGL immediate mode (glVertex3f and glTexCoord2f) by submitting the vertices and the texcoord according to the face indexes. All go fine for geometry rendering but not for UV Map : here is a link that show the problem :
Thanx in advance...
BYTE *data (= all the data of the file)
...
case CHUNK_UVMAP:
WORD numTexCoord = data[0];
data+=2;
for(int i=0;i<numTexCoord;i++)
{
// A Float type is 4 Byte so we get the first four byte of data pointer.
mesh.uvs.u = (*(float*))&data[0];
mesh.uvs.v = (*(float*))&data[4];
data+=8;
}
break;
case CHUNK_FACES:
WORD numFaces = *((WORD*)data);
data+=2;
for(int i=0;i<numFaces;i++)
{
mesh.Faces.a = *((WORD*))&data[0];
mesh.Faces.b = *((WORD*))&data[2];
mesh.Faces.c = *((WORD*))&data[4];
data+=8; // we skip 3*2Byte + 2Byte of flag for the face
}
break;
Thanx in advance...