summaryrefslogtreecommitdiffstats
path: root/progs/perf/glmain.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-09-21 16:55:12 +0100
committerKeith Whitwell <[email protected]>2009-09-22 11:21:09 +0100
commita7b2659f02c503bd2110b9fd9799efc113807ad9 (patch)
tree89a8997e2737df8739a258d4ef70f2438939524b /progs/perf/glmain.c
parent94a020cfe6cb1da04695897eed38b530af31f524 (diff)
progs/perf: add first attempt at a swapbuffers rate test
This is pretty ugly as the original framework assumed you'd set a single window size at startup and keep it throughout, but for swapbuffers you want to test the rate at various window sizes. With luck a nicer solution can be found, but this at least lays out a marker.
Diffstat (limited to 'progs/perf/glmain.c')
-rw-r--r--progs/perf/glmain.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/progs/perf/glmain.c b/progs/perf/glmain.c
index 83c7b8a79c8..8b41b8ee829 100644
--- a/progs/perf/glmain.c
+++ b/progs/perf/glmain.c
@@ -33,7 +33,6 @@
static int Win;
static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
-static GLboolean Anim = GL_FALSE;
/** Return time in seconds */
@@ -153,13 +152,23 @@ PerfShaderProgram(const char *vertShader, const char *fragShader)
}
+int
+PerfReshapeWindow( unsigned w, unsigned h )
+{
+ if (glutGet(GLUT_SCREEN_WIDTH) < w ||
+ glutGet(GLUT_SCREEN_HEIGHT) < h)
+ return 0;
+
+ glutReshapeWindow( w, h );
+ glutPostRedisplay();
+ return 1;
+}
+
+
static void
Idle(void)
{
- Xrot += 3.0;
- Yrot += 4.0;
- Zrot += 2.0;
- glutPostRedisplay();
+ PerfNextRound();
}
@@ -193,13 +202,6 @@ Key(unsigned char key, int x, int y)
(void) x;
(void) y;
switch (key) {
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
case 'z':
Zrot -= step;
break;
@@ -251,8 +253,7 @@ main(int argc, char *argv[])
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Draw);
- if (Anim)
- glutIdleFunc(Idle);
+ glutIdleFunc(Idle);
PerfInit();
glutMainLoop();
return 0;