summaryrefslogtreecommitdiff
path: root/progs/demos/readpix.c
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2010-01-12 11:25:02 +0800
committerChia-I Wu <olvaffe@gmail.com>2010-01-12 11:25:02 +0800
commit562c127693200822f04a145db50add1be2425d7b (patch)
tree9441774fb212b17ddf2a364f06abc43f166cc00b /progs/demos/readpix.c
parente5d351dcfde58777162552cf5cd2a9cd8299f4cd (diff)
parent077d6dd7508af88509dd0499c5dfbdaa186b4015 (diff)
Merge branch 'master' into opengl-es-v2
Conflicts: src/mesa/main/dd.h
Diffstat (limited to 'progs/demos/readpix.c')
-rw-r--r--progs/demos/readpix.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/progs/demos/readpix.c b/progs/demos/readpix.c
index bbb3a68eff..cc4e490269 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 {
@@ -382,12 +383,11 @@ int
main( int argc, char *argv[] )
{
GLboolean ciMode = GL_FALSE;
+ glutInitWindowSize( 750, 250 );
+ glutInit( &argc, argv );
if (argc > 1 && strcmp(argv[1], "-ci")==0) {
ciMode = GL_TRUE;
}
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 750, 250 );
if (ciMode)
glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE );
else