From 46d50d9e8ed5b060ef1591bf4b172de6d692cc9d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 22 Mar 2005 13:32:35 +0000 Subject: Add more formats to test. --- progs/demos/texdown.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/progs/demos/texdown.c b/progs/demos/texdown.c index 9f4f508691..79525a0395 100644 --- a/progs/demos/texdown.c +++ b/progs/demos/texdown.c @@ -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; -- cgit v1.2.3