[CSC 415] FPS code...

Andrew J. Pounds pounds at sandbox.mercer.edu
Fri Apr 19 14:35:25 EDT 2013


Hey guys -- here is the FPS code I promised.   I'll look around for a 
file where I have it implemented.

void showFPS()
{
     currentTime = time(NULL);
     char str_fps[15];
     if ( (currentTime - oldTime) >= 1.0 )
     {
         actualfps = fps;
         fps = 0;
         oldTime = currentTime;
     }
     else
         fps++;
     sprintf(&str_fps[0], "FPS = %.0f",actualfps);


     glPushMatrix();
         glTranslatef(-3.5, -3.5, -0.5);
         drawString(&str_fps[0]);
     glPopMatrix();
}


-- 
Andrew J. Pounds, Ph.D.  (pounds at theochem.mercer.edu)
Associate Professor of Chemistry and Computer Science
Mercer University,  Macon, GA 31207   (478) 301-5627



More information about the csc415 mailing list