Whats the deal with "byte"?

zip up just your source files and email me your code.

done

Ok, it was a memory problem. You were trying to process the frame data without having read it in. I made some changes to the code, so you should be back on track.

First:

typedef struct
{
float scale[3];
float translate[3];
char name[16];
triangleVertex_t vertices[1];
} aliasframe_t;

This structure stores your scaling and translation. Each vert is stored as a byte in the file, presumably to save space. These aren’t real coordinates, so thats why you have to scale and translate them back.

Next, I added this structure:

typedef struct
{
char strName[16];
triangle *pVertices;
} frame;

This is the structure that will contain your array of vertices. This frame structure is the one you declare in your MD2 class.

The alias frame structure is just for temporary storage as you will see.

Next, most of the modifications took place in the loadMD2 function. I will show you the changes I made:

After you open the file and such, allocate needed memory:

skin = new skinName[header.numSkins];
triangles = new triangle_t[header.numTriangles];
frames = new frame[header.numFrames];
texcords = new textureCoordinate_t[header.numTexCoords];

Then, read in the following info:

fseek(inputfile, header.offsetSkins, SEEK_SET);
fread(skin, sizeof(skinName), header.numSkins, inputfile);

fseek(inputfile, header.offsetTexCoords, SEEK_SET);
fread(texcords, sizeof(textureCoordinate_t), header.numTexCoords, inputfile);

fseek(inputfile, header.offsetTriangles, SEEK_SET);
fread(triangles, sizeof(triangle_t), header.numTriangles, inputfile);

The next part contains the changes I made.

/* this goes at the top of the file */
#define MD2_MAX_FRAMESIZE (MAX_VERTICES * 4 + 128)

/* this goes somewhere nice in your function */
unsigned char buffer[MD2_MAX_FRAMESIZE];

/* use aliasframe to point to the actual frame data in memory */
aliasframe_t pframe = (aliasframe_t)buffer;

/* read in the frame data */
fseek(inputfile, header.offsetFrames, SEEK_SET);
fread(pframe, 1, header.frameSize, inputfile);

/* copy the frame name */
strcpy(frames[0].strName,pframe->name);

/* close the file */
fclose(inputfile);

/* here is the scaling and translation part */
for( int i = 0; i < header.numVertices; i++ )
{
frames[0].pVertices[i].vertex[0] = pframe->vertices[i].vertex[0] * pframe->scale[0] + pframe->translate[0];
frames[0].pVertices[i].vertex[1] = pframe->vertices[i].vertex[2] * pframe->scale[2] + pframe->translate[2];
frames[0].pVertices[i].vertex[2] = -1 * (pframe->vertices[i].vertex[1] * pframe->scale[1] + pframe->translate[1]);
}

Make sure you see what is going on here. You are scaling and translating the vert data thats in memory (buffer) and copying it into your frame vertex array.

Now all the vertex data is in the vertex array, you can do whatever you want with it.
After I made these changes, the huge ugly chunk of for loop in the formatmd2 function started given me crap, so I just deleted it You should rewrite that anyway, now that everything is much cleaner to work with.

I emailed you back the source.

Old GLman