diff options
author | Brian Paul <[email protected]> | 2003-02-20 15:43:52 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-02-20 15:43:52 +0000 |
commit | 60f84fcc91c5fb86843c528416399303da113a2f (patch) | |
tree | 698d04b625c6efac205d76ae7d68b074102090f2 /src/glut/dos/window.c | |
parent | 449e47f06a46c42fb9895d13f37b599600225e56 (diff) |
latest DOS updates (Daniel Borca)
Diffstat (limited to 'src/glut/dos/window.c')
-rw-r--r-- | src/glut/dos/window.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/glut/dos/window.c b/src/glut/dos/window.c index a7a7d9ca59b..cad4726936f 100644 --- a/src/glut/dos/window.c +++ b/src/glut/dos/window.c @@ -27,12 +27,15 @@ */
+#include <stdio.h>
+
#include "glutint.h"
#include "GL/dmesa.h"
GLUTwindow *g_curwin;
+static GLuint swaptime, swapcount;
static DMesaVisual visual = NULL;
static DMesaContext context = NULL;
@@ -59,7 +62,6 @@ static void clean (void) int APIENTRY glutCreateWindow (const char *title)
{
int i;
- GLint screen_size[2];
int m8width = (g_init_w + 7) & ~7;
if (!visual) {
@@ -154,6 +156,20 @@ void APIENTRY glutSwapBuffers (void) } else {
DMesaSwapBuffers(g_curwin->buffer);
}
+
+ if (g_fps) {
+ GLint t = glutGet(GLUT_ELAPSED_TIME);
+ swapcount++;
+ if (swaptime == 0)
+ swaptime = t;
+ else if (t - swaptime > g_fps) {
+ double time = 0.001 * (t - swaptime);
+ double fps = (double)swapcount / time;
+ fprintf(stderr, "GLUT: %d frames in %.2f seconds = %.2f FPS\n", swapcount, time, fps);
+ swaptime = t;
+ swapcount = 0;
+ }
+ }
}
|