void display () { mint::Time start, stop; // iso = sin(frame*0.01f ); // Do simulation! if ( !bPause ) psys.Run (); frame++; measureFPS (); glEnable ( GL_DEPTH_TEST ); // Render depth map shadows start.SetSystemTime ( ACC_NSEC ); disableShadows (); #ifdef USE_SHADOWS if ( iShade==1 ) { renderDepthMap_FrameBuffer ( 0, window_width, window_height ); } else { renderDepthMap_Clear ( window_width, window_height ); } #endif // Clear frame buffer if ( iShade<=1 ) glClearColor( 0.29, 0.29, 0.29, 1.0 ); else glClearColor ( 0, 0, 0, 0 ); glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glDisable ( GL_CULL_FACE ); glShadeModel ( GL_SMOOTH ); // Compute camera view computeFromPositions (); computeProjection (); computeView (); // Draw Shadows (if on) #ifdef USE_SHADOWS if ( iShade==1 ) renderShadows ( view_matrix ); #endif // Draw 3D start.SetSystemTime ( ACC_NSEC ); glEnable ( GL_LIGHTING ); glLoadMatrixf ( view_matrix ); drawScene ( view_matrix, true ); if ( bTiming) { stop.SetSystemTime ( ACC_NSEC ); stop = stop - start; printf ( "SCENE: %s\n", stop.GetReadableTime().c_str() ); } // Draw 2D overlay draw2D (); // Swap buffers glutSwapBuffers(); glutPostRedisplay(); }
void step () { psys.Run(); frame++; }