Add more formats to test.

This commit is contained in:
Keith Whitwell 2005-03-22 13:32:35 +00:00
parent de4fe1e3c5
commit 46d50d9e8e

View 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;