static GLuint Mode = 0;
-#define NUM_FORMATS 4
struct FormatRec {
GLenum Format;
GLenum Type;
};
-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)
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 "";
}
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;