// ... calculate frame position....
int vCount = 0;
for(int i = 0; i < numTriangles; i++) {
//Calculate vertices interpolation
MD2Triangle* triangle = triangles + i;
for(int j = 0; j < 3; j++) {
MD2Vertex* v1 = frame1->vertices + triangle->vertices[j];
MD2Vertex* v2 = frame2->vertices + triangle->vertices[j];
Vec3f pos = v1->pos * (1 - frac) + v2->pos * frac;
Vec3f normal = v1->normal * (1 - frac) + v2->normal * frac;
if (normal[0] == 0 && normal[1] == 0 && normal[2] == 0) {
normal = Vec3f(0, 0, 1);
}
displayList[vCount] = normal[0];
displayList[vCount+1] = normal[1];
displayList[vCount+2] = normal[2];
vCount+=3;
MD2TexCoord* texCoord = texCoords + triangle->texCoords[j];
displayList[vCount] = texCoord->texCoordX;
displayList[vCount+1] = texCoord->texCoordY;
vCount+=2;
displayList[vCount] = pos[0];
displayList[vCount+1] = pos[1];
displayList[vCount+2] = pos[2];
vCount +=3;
}
}
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glNormalPointer(GL_FLOAT, 8*sizeof(float), &displayList[0]);
glTexCoordPointer(2, GL_FLOAT, 8*sizeof(float), &displayList[3]);
glVertexPointer(3, GL_FLOAT, 8*sizeof(float), &displayList[5]);
// Cel-Shading Code = Shade
glHint (GL_LINE_SMOOTH_HINT, GL_FASTEST); // Use The Good Calculations ( NEW )
glEnable (GL_LINE_SMOOTH);
glEnable (GL_TEXTURE_1D); // Enable 1D Texturing ( NEW )
glBindTexture (GL_TEXTURE_1D, shaderTexture[0]); // Bind Our Texture ( NEW )
glColor3f (1.0f, 1.0f, 1.0f); // Set The Color Of The Model ( NEW )
//PASS 1
glDrawArrays(GL_TRIANGLES, 0, numTriangles * 3);
glDisable (GL_TEXTURE_1D); // Disable 1D Textures ( NEW )
//Cel-Shading Code = Outline
glEnable (GL_BLEND); // Enable Blending ( NEW )
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // Set The Blend Mode ( NEW )
glPolygonMode (GL_BACK, GL_LINE); // Draw Backfacing Polygons As Wireframes ( NEW )
glLineWidth (outlineWidth); // Set The Line Width ( NEW )
glCullFace (GL_FRONT); // Don't Draw Any Front-Facing Polygons ( NEW )
glDepthFunc (GL_LEQUAL); // Change The Depth Mode ( NEW )
glColor3fv (&outlineColor[0]); // Set The Outline Color ( NEW )
//PASS 2
glDrawArrays(GL_TRIANGLES, 0, numTriangles * 3);
glDepthFunc (GL_LESS); // Reset The Depth-Testing Mode ( NEW )
glCullFace (GL_BACK); // Reset The Face To Be Culled ( NEW )
glPolygonMode (GL_BACK, GL_FILL); // Reset Back-Facing Polygon Drawing Mode ( NEW )
glDisable (GL_BLEND);
glDisableClientState(GL_VERTEX_ARRAY); // disable vertex arrays
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
Does this look as efficient as I can get without using vertex shaders?
Thanks a lot for your directions!

Find content
Not Telling