Add more formats to test.
authorKeith Whitwell <keith@tungstengraphics.com>
Tue, 22 Mar 2005 13:32:35 +0000 (13:32 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Tue, 22 Mar 2005 13:32:35 +0000 (13:32 +0000)
progs/demos/texdown.c

index 9f4f50869175c8afbf3f613f019dac8b543e096d..79525a0395e849778ec806c13e32fdc7c7274022 100644 (file)
@@ -47,7 +47,6 @@ static GLdouble DownloadRate = 0.0;  /* texels/sec */
 static GLuint Mode = 0;
 
 
-#define NUM_FORMATS 4
 struct FormatRec {
    GLenum Format;
    GLenum Type;
@@ -56,15 +55,20 @@ struct FormatRec {
 };
 
 
-static const struct FormatRec FormatTable[NUM_FORMATS] = {
+static const struct FormatRec FormatTable[] = {
   /* Format   Type                         IntFormat   TexelSize */
+   { GL_BGRA, GL_UNSIGNED_BYTE,            GL_RGBA,        4    },
    { GL_RGB,  GL_UNSIGNED_BYTE,            GL_RGB,         3    },
    { GL_RGBA, GL_UNSIGNED_BYTE,            GL_RGBA,        4    },
    { GL_RGBA, GL_UNSIGNED_BYTE,            GL_RGB,         4    },
    { GL_RGB,  GL_UNSIGNED_SHORT_5_6_5,     GL_RGB,         2    },
+   { GL_LUMINANCE, GL_UNSIGNED_BYTE,       GL_LUMINANCE,   1    },
+   { GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_LUMINANCE_ALPHA,   2    },
+   { GL_ALPHA, GL_UNSIGNED_BYTE,           GL_ALPHA,       1    },
 };
 static GLint Format;
 
+#define NUM_FORMATS (sizeof(FormatTable)/sizeof(FormatTable[0]))
 
 static int
 BytesPerTexel(GLint format)
@@ -81,6 +85,14 @@ FormatStr(GLenum format)
          return "GL_RGB";
       case GL_RGBA:
          return "GL_RGBA";
+      case GL_BGRA:
+         return "GL_BGRA";
+      case GL_LUMINANCE:
+         return "GL_LUMINANCE";
+      case GL_LUMINANCE_ALPHA:
+         return "GL_LUMINANCE_ALPHA";
+      case GL_ALPHA:
+         return "GL_ALPHA";
       default:
          return "";
    }
@@ -314,6 +326,11 @@ Key(unsigned char key, int x, int y)
          Format = (Format + 1) % NUM_FORMATS;
          Mode = 0;
          break;
+      case 'F':
+         /* change format */
+         Format = (Format - 1) % NUM_FORMATS;
+         Mode = 0;
+         break;
       case 'p':
          /* toggle border */
          ScaleAndBias = !ScaleAndBias;