summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-10-16 21:24:39 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-10-16 21:24:39 +0000
commit1100b4daa30ba6604a4d01aa6d46780dd8ef256b (patch)
treeb5815eb0893d959ee557e223139c92431a657c4f
parent35324a6c60cedf217934db1a7a0c11a7f553d2d4 (diff)
use gray background, memset TempImage to white to help with debugging
-rw-r--r--progs/demos/readpix.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/progs/demos/readpix.c b/progs/demos/readpix.c
index 32225b7961..238ef2ee1f 100644
--- a/progs/demos/readpix.c
+++ b/progs/demos/readpix.c
@@ -1,4 +1,4 @@
-/* $Id: readpix.c,v 1.3 2000/03/31 01:01:31 brianp Exp $ */
+/* $Id: readpix.c,v 1.4 2000/10/16 21:24:39 brianp Exp $ */
/*
* glReadPixels and glCopyPixels test
@@ -8,6 +8,9 @@
/*
* $Log: readpix.c,v $
+ * Revision 1.4 2000/10/16 21:24:39 brianp
+ * use gray background, memset TempImage to white to help with debugging
+ *
* Revision 1.3 2000/03/31 01:01:31 brianp
* tweaks to allow different read formats/types
*
@@ -43,11 +46,11 @@ static GLboolean ScaleAndBias = GL_FALSE;
static GLboolean Benchmark = GL_FALSE;
static GLubyte *TempImage = NULL;
-#if 1
+#if 0
#define ReadFormat ImgFormat
#define ReadType GL_UNSIGNED_BYTE
#endif
-#if 0
+#if 1
static GLenum ReadFormat = GL_RGBA;
static GLenum ReadType = GL_UNSIGNED_BYTE;
#endif
@@ -55,6 +58,18 @@ static GLenum ReadType = GL_UNSIGNED_BYTE;
static GLenum ReadFormat = GL_RGB;
static GLenum ReadType = GL_UNSIGNED_SHORT_5_6_5;
#endif
+#if 0
+static GLenum ReadFormat = GL_RGBA;
+static GLenum ReadType = GL_UNSIGNED_SHORT_1_5_5_5_REV;
+#endif
+#if 0
+static GLenum ReadFormat = GL_BGRA;
+static GLenum ReadType = GL_UNSIGNED_SHORT_5_5_5_1;
+#endif
+#if 0
+static GLenum ReadFormat = GL_BGRA;
+static GLenum ReadType = GL_UNSIGNED_SHORT_4_4_4_4_REV;
+#endif
static void
@@ -101,6 +116,7 @@ SetupPixelTransfer(GLboolean invert)
static void
Display( void )
{
+ glClearColor(.3, .3, .3, 1);
glClear( GL_COLOR_BUFFER_BIT );
glRasterPos2i(5, ImgHeight+25);
@@ -137,6 +153,8 @@ Display( void )
Benchmark = GL_FALSE;
}
else {
+ /* clear the temporary image to white (helpful for debugging */
+ memset(TempImage, 255, ImgWidth * ImgHeight * 4);
glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
ReadFormat, ReadType, TempImage);
}