engine: also print fps data to stdout
Useful for figuring out how much of a perf impact the glBitmap fps display has on a given driver.
This commit is contained in:
@@ -964,6 +964,28 @@ Draw(void)
|
|||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* also print out a periodic fps to stdout. useful for trying to
|
||||||
|
* figure out the performance impact of rendering the string above
|
||||||
|
* with glBitmap.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
static GLint T0 = 0;
|
||||||
|
static GLint Frames = 0;
|
||||||
|
GLint t = glutGet(GLUT_ELAPSED_TIME);
|
||||||
|
|
||||||
|
Frames++;
|
||||||
|
|
||||||
|
if (t - T0 >= 5000) {
|
||||||
|
GLfloat seconds = (t - T0) / 1000.0;
|
||||||
|
GLfloat fps = Frames / seconds;
|
||||||
|
printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
|
||||||
|
fflush(stdout);
|
||||||
|
T0 = t;
|
||||||
|
Frames = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
glutSwapBuffers();
|
glutSwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user