
i
i
i
i
i
i
i
i
13.1. Visualizing a Virtual World Using OpenGL 323
void FreeObject(void){
///// Free up all the memory buffers used to hold
...// the mesh detail and reset pointers
MainVp=NULL; MainFp=NULL; MapsFp=NULL;
Nvert=0; Nface=0; NvertGlue=0; Nmap=0;
}
void LoadModel(char
*
CurrentDirFile, int fid){ // load the mesh
FreeObject(); // make sure existing mesh is gone
if(fid == FI_3DS)Load3dsObject(CurrentDirFile); // select loading function
else LoadOfxObject(CurrentDirFile); // by filename extension
ListAdjFaces(); // find a list of all polygons which are adjaent
// to each other
FixUpOrientation(); // make sure all the faces have consistent normals
StripFaces(); ...