[source lang="cpp"]//original display function/* Draw each mesh of the model */ for (i = 0; i < md5file.num_meshes; ++i) { PrepareMesh (&md5file.meshes[i], skeleton); glVertexPointer (3, GL_FLOAT, 0, vertexArray); glDrawElements (GL_TRIANGLES, md5file.meshes[i].num_tris * 3, GL_UNSIGNED_INT, vertexIndices); }[/source]
[source lang="cpp"]//My function /* Draw each mesh of the model */ for (i = 0; i < md5file.num_meshes; ++i) { PrepareMesh (&md5file.meshes[i], skeleton); glVertexPointer (3, GL_FLOAT, 0, vertexArray); do { //glColor4f /*if transparent*/ glBegin(GL_TRIANGLES); //gltexcoord2f() //times = times + 1; glVertex3f(vertexArray[times][0],vertexArray[times][1],vertexArray[times][2]); //gltexcoord2f() times = times + 1; glVertex3f(vertexArray[times][0],vertexArray[times][1],vertexArray[times][2]); //gltexcoord2f() times = times + 1; glVertex3f(vertexArray[times][0],vertexArray[times][1],vertexArray[times][2]); glEnd(); times = times + 1; }while(times < md5file.meshes[i].num_tris); } glutSwapBuffers (); glutPostRedisplay ();}[/source]
. When I compiled it the outline of the model looks fine but the triangles of it are not correct.







