void DisplayFunc(void) { static int done=0; static int step=1; if (!done) { glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT ); char t; double time; fscanf(fp, "%c", &t); fscanf(fp, "t %lf", &time); double ogl_trans[16]; if (time <5.57) { std::cout<<"step = "<<step<<"\n"; step++; int i; for (i=0; i<num_of_polytopes; i++) { UpdatePolytope(i, ogl_trans); polytope[i]->Display(ogl_trans); } glutSwapBuffers(); CollisionTestAndReport(); } else { done=1; } } }
//the simulation_loop... void simulation_loop(int *argc, char *argv[]) { #ifdef OGL_GRAPHICS grInit(argc, argv); #else for(;;) { static int step=1; cout<<"step = "<<step<<"\n"; step++; char t; double time; fscanf(fp, "%c", &t); fscanf(fp, "t %lf", &time); double ogl_trans[16]; if (time <5.57) { int i; for (i=0; i<num_of_polytopes; i++) { UpdatePolytope(i, ogl_trans); } CollisionTestAndReport(); } else { break; } } #endif }