From 79e74cda7347170f1015829ceafb0f5f18dd9236 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 11 Dec 2009 15:22:17 -0700 Subject: progs/demos: report pixel rate in million pixels / sec --- progs/demos/readpix.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'progs/demos/readpix.c') diff --git a/progs/demos/readpix.c b/progs/demos/readpix.c index bbb3a68eff..182b01d7ff 100644 --- a/progs/demos/readpix.c +++ b/progs/demos/readpix.c @@ -219,7 +219,7 @@ Display( void ) GLint reads = 0; GLint endTime; GLint startTime = glutGet(GLUT_ELAPSED_TIME); - GLdouble seconds, pixelsPerSecond; + GLdouble seconds, mpixels, mpixelsPerSecond; printf("Benchmarking...\n"); do { glReadPixels(APosX, APosY, ImgWidth, ImgHeight, @@ -228,9 +228,10 @@ Display( void ) endTime = glutGet(GLUT_ELAPSED_TIME); } while (endTime - startTime < 4000); /* 4 seconds */ seconds = (double) (endTime - startTime) / 1000.0; - pixelsPerSecond = reads * ImgWidth * ImgHeight / seconds; - printf("Result: %d reads in %f seconds = %f pixels/sec\n", - reads, seconds, pixelsPerSecond); + mpixels = reads * (ImgWidth * ImgHeight / (1000.0 * 1000.0)); + mpixelsPerSecond = mpixels / seconds; + printf("Result: %d reads in %f seconds = %f Mpixels/sec\n", + reads, seconds, mpixelsPerSecond); Benchmark = GL_FALSE; } else { -- cgit v1.2.3