c - How to calculate FPS in OpenGL? -
void calculateframerate() { static float framespersecond = 0.0f; // store our fps static float lasttime = 0.0f; // hold time last frame float currenttime = gettickcount() * 0.001f; ++framespersecond; if( currenttime - lasttime > 1.0f ) { lasttime = currenttime; if(show_fps == 1) fprintf(stderr, "\ncurrent frames per second: %d\n\n", (int)framespersecond); framespersecond = 0; } } should call function in void play(void) or void display(void)?
or not make difference?
you should put in display loop. here's article explains intricacies of game loops should read.
Comments
Post a Comment