From: Brian Paul Date: Fri, 31 Mar 2000 01:01:31 +0000 (+0000) Subject: tweaks to allow different read formats/types X-Git-Tag: 062012170305~28224 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3d72804b0737835e50cc3565a2c46b946506f63;p=profile%2Fivi%2Fmesa.git tweaks to allow different read formats/types --- diff --git a/progs/demos/readpix.c b/progs/demos/readpix.c index dd3a0af..32225b7 100644 --- a/progs/demos/readpix.c +++ b/progs/demos/readpix.c @@ -1,4 +1,4 @@ -/* $Id: readpix.c,v 1.2 2000/03/23 19:47:25 brianp Exp $ */ +/* $Id: readpix.c,v 1.3 2000/03/31 01:01:31 brianp Exp $ */ /* * glReadPixels and glCopyPixels test @@ -8,6 +8,9 @@ /* * $Log: readpix.c,v $ + * Revision 1.3 2000/03/31 01:01:31 brianp + * tweaks to allow different read formats/types + * * Revision 1.2 2000/03/23 19:47:25 brianp * added benchmarking * @@ -40,6 +43,19 @@ static GLboolean ScaleAndBias = GL_FALSE; static GLboolean Benchmark = GL_FALSE; static GLubyte *TempImage = NULL; +#if 1 +#define ReadFormat ImgFormat +#define ReadType GL_UNSIGNED_BYTE +#endif +#if 0 +static GLenum ReadFormat = GL_RGBA; +static GLenum ReadType = GL_UNSIGNED_BYTE; +#endif +#if 0 +static GLenum ReadFormat = GL_RGB; +static GLenum ReadType = GL_UNSIGNED_SHORT_5_6_5; +#endif + static void Reset( void ) @@ -110,7 +126,7 @@ Display( void ) printf("Benchmarking...\n"); do { glReadPixels(APosX, APosY, ImgWidth, ImgHeight, - ImgFormat, GL_UNSIGNED_BYTE, TempImage); + ReadFormat, ReadType, TempImage); reads++; endTime = glutGet(GLUT_ELAPSED_TIME); } while (endTime - startTime < 4000); /* 4 seconds */ @@ -122,12 +138,12 @@ Display( void ) } else { glReadPixels(APosX, APosY, ImgWidth, ImgHeight, - ImgFormat, GL_UNSIGNED_BYTE, TempImage); + ReadFormat, ReadType, TempImage); } glRasterPos2i(BPosX, BPosY); glDisable(GL_DITHER); SetupPixelTransfer(GL_FALSE); - glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, TempImage); + glDrawPixels(ImgWidth, ImgHeight, ReadFormat, ReadType, TempImage); /* do copypixels */ glRasterPos2i(CPosX, 5);