summaryrefslogtreecommitdiffstats
path: root/progs/tests
diff options
context:
space:
mode:
Diffstat (limited to 'progs/tests')
-rw-r--r--progs/tests/Makefile8
-rw-r--r--progs/tests/SConscript1
-rw-r--r--progs/tests/arraytexture.c19
-rw-r--r--progs/tests/blitfb.c259
-rw-r--r--progs/tests/copypixrate.c2
-rw-r--r--progs/tests/crossbar.c2
-rw-r--r--progs/tests/invert.c2
-rw-r--r--progs/tests/minmag.c1
-rw-r--r--progs/tests/mipmap_limits.c237
-rw-r--r--progs/tests/prog_parameter.c20
-rw-r--r--progs/tests/random.c2
-rw-r--r--progs/tests/stencil_twoside.c6
-rw-r--r--progs/tests/texcmp.c8
-rw-r--r--progs/tests/texcomp_image.h2
14 files changed, 425 insertions, 144 deletions
diff --git a/progs/tests/Makefile b/progs/tests/Makefile
index 4d9b4e8388c..197e14d5b00 100644
--- a/progs/tests/Makefile
+++ b/progs/tests/Makefile
@@ -25,9 +25,11 @@ SOURCES = \
arbvptorus.c \
arbvpwarpmesh.c \
arraytexture.c \
+ auxbuffer.c \
blendminmax.c \
blendsquare.c \
blendxor.c \
+ blitfb.c \
bufferobj.c \
bumpmap.c \
bug_3050.c \
@@ -40,6 +42,7 @@ SOURCES = \
cva.c \
drawbuffers.c \
exactrast.c \
+ ext422square.c \
floattex.c \
fbotest1.c \
fbotest2.c \
@@ -65,6 +68,8 @@ SOURCES = \
mipmap_limits.c \
mipmap_view.c \
multipal.c \
+ multitexarray.c \
+ multiwindow.c \
no_s3tc.c \
packedpixels.c \
pbo.c \
@@ -87,10 +92,12 @@ SOURCES = \
subtex \
subtexrate.c \
tex1d.c \
+ texcmp.c \
texcompress2.c \
texcompsub.c \
texdown \
texfilt.c \
+ texgenmix.c \
texline.c \
texobj.c \
texobjshare.c \
@@ -100,6 +107,7 @@ SOURCES = \
vao-01.c \
vao-02.c \
vparray.c \
+ vpeval.c \
vptest1.c \
vptest2.c \
vptest3.c \
diff --git a/progs/tests/SConscript b/progs/tests/SConscript
index bb6a1d2b8a9..3a0da62717c 100644
--- a/progs/tests/SConscript
+++ b/progs/tests/SConscript
@@ -52,6 +52,7 @@ progs = [
'blendminmax',
'blendsquare',
'blendxor',
+ 'blitfb',
'bufferobj',
'bug_3050',
'bug_3101',
diff --git a/progs/tests/arraytexture.c b/progs/tests/arraytexture.c
index 6c0484df0de..28252a354bf 100644
--- a/progs/tests/arraytexture.c
+++ b/progs/tests/arraytexture.c
@@ -77,10 +77,6 @@ static GLfloat texZ = 0.0;
static GLfloat texZ_dir = 0.01;
static GLint num_layers;
-static PFNGLBINDPROGRAMARBPROC bind_program;
-static PFNGLPROGRAMSTRINGARBPROC program_string;
-static PFNGLGENPROGRAMSARBPROC gen_programs;
-
static void
PrintString(const char *s)
@@ -125,13 +121,13 @@ static void Display(void)
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0);
+ glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
glColor3f(1,1,1);
glRasterPos3f(-0.9, -0.9, 0.0);
sprintf(str, "Texture Z coordinate = %4.1f", texZ);
PrintString(str);
- (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 1);
+ glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 1);
GL_CHECK_ERROR();
glEnable(GL_TEXTURE_2D_ARRAY_EXT);
GL_CHECK_ERROR();
@@ -159,7 +155,7 @@ static void Display(void)
glDisable(GL_TEXTURE_2D_ARRAY_EXT);
GL_CHECK_ERROR();
- (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0);
+ glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
GL_CHECK_ERROR();
glutSwapBuffers();
@@ -226,8 +222,8 @@ compile_fragment_program(GLuint id, const char *prog)
int err;
err = glGetError();
- (*bind_program)(GL_FRAGMENT_PROGRAM_ARB, id);
- (*program_string)(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
+ glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, id);
+ glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog), (const GLubyte *) prog);
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
@@ -264,11 +260,6 @@ static void Init(void)
require_extension("GL_MESA_texture_array");
require_extension("GL_SGIS_generate_mipmap");
- bind_program = glutGetProcAddress("glBindProgramARB");
- program_string = glutGetProcAddress("glProgramStringARB");
- gen_programs = glutGetProcAddress("glGenProgramsARB");
-
-
for (num_layers = 0; textures[num_layers] != NULL; num_layers++)
/* empty */ ;
diff --git a/progs/tests/blitfb.c b/progs/tests/blitfb.c
new file mode 100644
index 00000000000..18c8380a5e2
--- /dev/null
+++ b/progs/tests/blitfb.c
@@ -0,0 +1,259 @@
+/**
+ * Test glFramebufferBlit()
+ * Brian Paul
+ * 27 Oct 2009
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+
+
+static int Win;
+static int WinWidth = 1100, WinHeight = 600;
+
+static int SrcWidth = 512, SrcHeight = 512;
+static int DstWidth = 512, DstHeight = 512;
+
+static GLuint SrcFB, DstFB;
+static GLuint SrcTex, DstTex;
+
+#if 0
+static GLenum SrcTexTarget = GL_TEXTURE_2D, SrcTexFace = GL_TEXTURE_2D;
+#else
+static GLenum SrcTexTarget = GL_TEXTURE_CUBE_MAP, SrcTexFace = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+#endif
+
+static GLenum DstTexTarget = GL_TEXTURE_2D, DstTexFace = GL_TEXTURE_2D;
+
+static GLuint SrcTexLevel = 01, DstTexLevel = 0;
+
+
+static void
+Draw(void)
+{
+ GLboolean rp = GL_FALSE;
+ GLubyte *buf;
+ GLint srcWidth = SrcWidth >> SrcTexLevel;
+ GLint srcHeight = SrcHeight >> SrcTexLevel;
+ GLint dstWidth = DstWidth >> DstTexLevel;
+ GLint dstHeight = DstHeight >> DstTexLevel;
+ GLenum status;
+
+ /* clear window */
+ glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
+ glClearColor(0.5, 0.5, 0.5, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+
+ /* clear src buf */
+ glBindFramebufferEXT(GL_FRAMEBUFFER, SrcFB);
+ status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+ assert(status == GL_FRAMEBUFFER_COMPLETE_EXT);
+ glClearColor(0, 1, 0, 0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* clear dst buf */
+ glBindFramebufferEXT(GL_FRAMEBUFFER, DstFB);
+ status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+ assert(status == GL_FRAMEBUFFER_COMPLETE_EXT);
+ glClearColor(1, 0, 0, 0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* blit src -> dst */
+ glBindFramebufferEXT(GL_READ_FRAMEBUFFER, SrcFB);
+ glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, DstFB);
+ glBlitFramebufferEXT(0, 0, srcWidth, srcHeight,
+ 0, 0, dstWidth, dstHeight,
+ GL_COLOR_BUFFER_BIT, GL_NEAREST);
+
+#if 01
+ /* read src results */
+ buf = malloc(4 * srcWidth * srcHeight);
+ memset(buf, 0x88, 4 * srcWidth * srcHeight);
+ glBindFramebufferEXT(GL_FRAMEBUFFER, SrcFB);
+ if (rp)
+ glReadPixels(0, 0, srcWidth, srcHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf);
+ else {
+ glBindTexture(SrcTexTarget, SrcTex);
+ glGetTexImage(SrcTexFace, SrcTexLevel, GL_RGBA, GL_UNSIGNED_BYTE, buf);
+ }
+
+ /* draw dst in window */
+ glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
+ glWindowPos2i(0, 0);
+ glDrawPixels(srcWidth, srcHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf);
+
+ printf("Src Pix[0] = %d %d %d %d\n", buf[0], buf[1], buf[2], buf[3]);
+ free(buf);
+#endif
+
+ glFinish();
+
+ /* read dst results */
+ buf = malloc(4 * dstWidth * dstHeight);
+ memset(buf, 0x88, 4 * dstWidth * dstHeight);
+ glBindFramebufferEXT(GL_FRAMEBUFFER, DstFB);
+ if (rp)
+ glReadPixels(0, 0, dstWidth, dstHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf);
+ else {
+ glBindTexture(DstTexTarget, DstTex);
+ glGetTexImage(DstTexFace, DstTexLevel, GL_RGBA, GL_UNSIGNED_BYTE, buf);
+ }
+
+ /* draw dst in window */
+ glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
+ glWindowPos2i(srcWidth + 2, 0);
+ glDrawPixels(dstWidth, dstHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf);
+
+ printf("Dst Pix[0] = %d %d %d %d\n", buf[0], buf[1], buf[2], buf[3]);
+ free(buf);
+
+ glFinish();
+
+ glutSwapBuffers();
+}
+
+
+static void
+Reshape(int width, int height)
+{
+ WinWidth = width;
+ WinHeight = height;
+ glViewport(0, 0, width, height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.0, 0.0, -15.0);
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+ (void) x;
+ (void) y;
+ switch (key) {
+ case 27:
+ glutDestroyWindow(Win);
+ exit(0);
+ break;
+ }
+ glutPostRedisplay();
+}
+
+
+static void
+SpecialKey(int key, int x, int y)
+{
+ (void) x;
+ (void) y;
+ switch (key) {
+ }
+ glutPostRedisplay();
+}
+
+
+static void
+InitFBOs(void)
+{
+ GLuint w, h, lvl;
+
+ /* Src */
+ glGenTextures(1, &SrcTex);
+ glBindTexture(SrcTexTarget, SrcTex);
+ w = SrcWidth;
+ h = SrcHeight;
+ lvl = 0;
+ for (lvl = 0; ; lvl++) {
+ if (SrcTexTarget == GL_TEXTURE_CUBE_MAP) {
+ GLuint f;
+ for (f = 0; f < 6; f++) {
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, lvl, GL_RGBA8,
+ w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ }
+ }
+ else {
+ /* single face */
+ glTexImage2D(SrcTexFace, lvl, GL_RGBA8, w, h, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ }
+ if (w == 1 && h == 1)
+ break;
+ if (w > 1)
+ w /= 2;
+ if (h > 1)
+ h /= 2;
+ }
+
+ glGenFramebuffersEXT(1, &SrcFB);
+ glBindFramebufferEXT(GL_FRAMEBUFFER, SrcFB);
+ glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+ SrcTexFace, SrcTex, SrcTexLevel);
+
+ /* Dst */
+ glGenTextures(1, &DstTex);
+ glBindTexture(DstTexTarget, DstTex);
+ w = DstWidth;
+ h = DstHeight;
+ lvl = 0;
+ for (lvl = 0; ; lvl++) {
+ glTexImage2D(DstTexFace, lvl, GL_RGBA8, w, h, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ if (w == 1 && h == 1)
+ break;
+ if (w > 1)
+ w /= 2;
+ if (h > 1)
+ h /= 2;
+ }
+
+ glGenFramebuffersEXT(1, &DstFB);
+ glBindFramebufferEXT(GL_FRAMEBUFFER, DstFB);
+ glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+ DstTexFace, DstTex, DstTexLevel);
+}
+
+
+static void
+Init(void)
+{
+ if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
+ fprintf(stderr, "This test requires GL_EXT_framebuffer_object\n");
+ exit(1);
+ }
+
+ if (!glutExtensionSupported("GL_EXT_framebuffer_blit")) {
+ fprintf(stderr, "This test requires GL_EXT_framebuffer_blit,\n");
+ exit(1);
+ }
+
+ InitFBOs();
+
+ printf("Left rect = src FBO, Right rect = dst FBO.\n");
+ printf("Both should be green.\n");
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ glutInit(&argc, argv);
+ glutInitWindowSize(WinWidth, WinHeight);
+ glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
+ Win = glutCreateWindow(argv[0]);
+ glewInit();
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(SpecialKey);
+ glutDisplayFunc(Draw);
+ Init();
+ glutMainLoop();
+ return 0;
+}
diff --git a/progs/tests/copypixrate.c b/progs/tests/copypixrate.c
index aa4acfc18b5..f63d59f3cec 100644
--- a/progs/tests/copypixrate.c
+++ b/progs/tests/copypixrate.c
@@ -69,7 +69,7 @@ DrawTestImage(void)
static int
Rand(int max)
{
- return ((int) random()) % max;
+ return ((int) rand()) % max;
}
diff --git a/progs/tests/crossbar.c b/progs/tests/crossbar.c
index 3dd21372f9a..bd8e05aee13 100644
--- a/progs/tests/crossbar.c
+++ b/progs/tests/crossbar.c
@@ -145,7 +145,7 @@ static void Init( void )
{
const char * const ver_string = (const char * const)
glGetString( GL_VERSION );
- float ver = strtof( ver_string, NULL );
+ float ver = strtod( ver_string, NULL );
GLint tex_units;
GLint temp[ 256 ];
diff --git a/progs/tests/invert.c b/progs/tests/invert.c
index 63099fbd221..3bc97a460b6 100644
--- a/progs/tests/invert.c
+++ b/progs/tests/invert.c
@@ -128,7 +128,7 @@ static void Init( void )
{
const char * const ver_string = (const char * const)
glGetString( GL_VERSION );
- const float ver = strtof( ver_string, NULL );
+ const float ver = strtod( ver_string, NULL );
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
diff --git a/progs/tests/minmag.c b/progs/tests/minmag.c
index 03019f94faa..179be511207 100644
--- a/progs/tests/minmag.c
+++ b/progs/tests/minmag.c
@@ -16,7 +16,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <GL/glew.h>
#include <GL/glut.h>
diff --git a/progs/tests/mipmap_limits.c b/progs/tests/mipmap_limits.c
index 5b899cd1551..9418e909815 100644
--- a/progs/tests/mipmap_limits.c
+++ b/progs/tests/mipmap_limits.c
@@ -77,15 +77,16 @@ InitValues(void)
}
-static void MakeImage(int level, int width, int height, const GLubyte color[4])
+static void
+MakeImage(int level, int width, int height, const GLubyte color[4])
{
const int makeStripes = 0;
- GLubyte img[512*512*3];
+ GLubyte img[512 * 512 * 3];
int i, j;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
int k = (i * width + j) * 3;
- int p = (i/8) & makeStripes;
+ int p = (i / 8) & makeStripes;
if (p == 0) {
img[k + 0] = color[0];
img[k + 1] = color[1];
@@ -104,7 +105,8 @@ static void MakeImage(int level, int width, int height, const GLubyte color[4])
}
-static void makeImages(int image)
+static void
+makeImages(int image)
{
#define WIDTH 512
#define HEIGHT 512
@@ -121,19 +123,20 @@ static void makeImages(int image)
if (width != WIDTH || height != HEIGHT) {
GLubyte *newImage = malloc(WIDTH * HEIGHT * 4);
gluScaleImage(format, width, height, GL_UNSIGNED_BYTE, image,
- WIDTH, HEIGHT, GL_UNSIGNED_BYTE, newImage);
+ WIDTH, HEIGHT, GL_UNSIGNED_BYTE, newImage);
free(image);
image = newImage;
}
printf("Using GL_SGIS_generate_mipmap\n");
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
glTexImage2D(GL_TEXTURE_2D, 0, format, WIDTH, HEIGHT, 0,
- format, GL_UNSIGNED_BYTE, image);
+ format, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
free(image);
/* make sure mipmap was really generated correctly */
- width = WIDTH; height = HEIGHT;
+ width = WIDTH;
+ height = HEIGHT;
for (i = 0; i < 10; i++) {
GLint w, h;
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_WIDTH, &w);
@@ -142,18 +145,19 @@ static void makeImages(int image)
width /= 2;
height /= 2;
}
- } else {
+ }
+ else {
static const GLubyte colors[10][3] = {
- {128, 128, 128 },
- { 0, 255, 255 },
- { 255, 255, 0 },
- { 255, 0, 255 },
- { 255, 0, 0 },
- { 0, 255, 0 },
- { 0, 0, 255 },
- { 0, 255, 255 },
- { 255, 255, 0 },
- { 255, 255, 255 }
+ {128, 128, 128},
+ {0, 255, 255},
+ {255, 255, 0},
+ {255, 0, 255},
+ {255, 0, 0},
+ {0, 255, 0},
+ {0, 0, 255},
+ {0, 255, 255},
+ {255, 255, 0},
+ {255, 255, 255}
};
int i, sz = 512;
@@ -165,7 +169,8 @@ static void makeImages(int image)
}
}
-static void myinit(void)
+static void
+myinit(void)
{
InitValues();
@@ -191,14 +196,16 @@ static void myinit(void)
glEnable(GL_TEXTURE_2D);
}
-static void display(void)
+static void
+display(void)
{
GLfloat tcm = 1.0;
glBindTexture(GL_TEXTURE_2D, texCurrent);
- printf("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n",
- BaseLevel, MaxLevel, MinLod, MaxLod, LodBias,
- NearestFilter ? "NEAREST" : "LINEAR");
+ printf
+ ("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n",
+ BaseLevel, MaxLevel, MinLod, MaxLod, LodBias,
+ NearestFilter ? "NEAREST" : "LINEAR");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel);
@@ -208,103 +215,44 @@ static void display(void)
if (NearestFilter) {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_NEAREST_MIPMAP_NEAREST);
+ GL_NEAREST_MIPMAP_NEAREST);
}
else {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR_MIPMAP_LINEAR);
+ GL_LINEAR_MIPMAP_LINEAR);
}
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_QUADS);
- glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0);
- glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0);
- glTexCoord2f(tcm * 3000.0, tcm); glVertex3f(3000.0, 1.0, -6000.0);
- glTexCoord2f(tcm * 3000.0, 0.0); glVertex3f(3000.0, -1.0, -6000.0);
+ glTexCoord2f(0.0, 0.0);
+ glVertex3f(-2.0, -1.0, 0.0);
+ glTexCoord2f(0.0, tcm);
+ glVertex3f(-2.0, 1.0, 0.0);
+ glTexCoord2f(tcm * 3000.0, tcm);
+ glVertex3f(3000.0, 1.0, -6000.0);
+ glTexCoord2f(tcm * 3000.0, 0.0);
+ glVertex3f(3000.0, -1.0, -6000.0);
glEnd();
glFlush();
}
-static void myReshape(int w, int h)
+static void
+myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0);
+ gluPerspective(60.0, 1.0 * (GLfloat) w / (GLfloat) h, 1.0, 30000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
-static void
-key(unsigned char k, int x, int y)
-{
- (void) x;
- (void) y;
- switch (k) {
- case 'b':
- BaseLevel--;
- if (BaseLevel < 0)
- BaseLevel = 0;
- break;
- case 'B':
- BaseLevel++;
- if (BaseLevel > 10)
- BaseLevel = 10;
- break;
- case 'm':
- MaxLevel--;
- if (MaxLevel < 0)
- MaxLevel = 0;
- break;
- case 'M':
- MaxLevel++;
- if (MaxLevel > 10)
- MaxLevel = 10;
- break;
- case 'l':
- LodBias -= 0.25;
- break;
- case 'L':
- LodBias += 0.25;
- break;
- case 'n':
- MinLod -= 0.25;
- break;
- case 'N':
- MinLod += 0.25;
- break;
- case 'x':
- MaxLod -= 0.25;
- break;
- case 'X':
- MaxLod += 0.25;
- break;
- case 'f':
- NearestFilter = !NearestFilter;
- break;
- case 't':
- if (texCurrent == texColor)
- texCurrent = texImage;
- else
- texCurrent = texColor;
- break;
- case ' ':
- InitValues();
- break;
- case 27: /* Escape */
- exit(0);
- break;
- default:
- return;
- }
- glutPostRedisplay();
-}
-
-static void usage(void)
+static void
+usage(void)
{
printf("usage:\n");
printf(" b/B decrease/increase GL_TEXTURE_BASE_LEVEL\n");
@@ -317,19 +265,88 @@ static void usage(void)
printf(" SPACE reset values\n");
}
+static void
+key(unsigned char k, int x, int y)
+{
+ (void) x;
+ (void) y;
+ switch (k) {
+ case 'b':
+ BaseLevel--;
+ if (BaseLevel < 0)
+ BaseLevel = 0;
+ break;
+ case 'B':
+ BaseLevel++;
+ if (BaseLevel > 10)
+ BaseLevel = 10;
+ break;
+ case 'm':
+ MaxLevel--;
+ if (MaxLevel < 0)
+ MaxLevel = 0;
+ break;
+ case 'M':
+ MaxLevel++;
+ if (MaxLevel > 10)
+ MaxLevel = 10;
+ break;
+ case 'l':
+ LodBias -= 0.25;
+ break;
+ case 'L':
+ LodBias += 0.25;
+ break;
+ case 'n':
+ MinLod -= 0.25;
+ break;
+ case 'N':
+ MinLod += 0.25;
+ break;
+ case 'x':
+ MaxLod -= 0.25;
+ break;
+ case 'X':
+ MaxLod += 0.25;
+ break;
+ case 'f':
+ NearestFilter = !NearestFilter;
+ break;
+ case 't':
+ if (texCurrent == texColor)
+ texCurrent = texImage;
+ else
+ texCurrent = texColor;
+ break;
+ case ' ':
+ InitValues();
+ /* fall-through */
+ case 'u':
+ usage();
+ break;
+ case 27: /* Escape */
+ exit(0);
+ break;
+ default:
+ return;
+ }
+ glutPostRedisplay();
+}
+
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
- glutInit(&argc, argv);
- glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
- glutInitWindowSize (600, 600);
- glutCreateWindow (argv[0]);
- glewInit();
- myinit();
- glutReshapeFunc (myReshape);
- glutDisplayFunc(display);
- glutKeyboardFunc(key);
- usage();
- glutMainLoop();
- return 0; /* ANSI C requires main to return int. */
+ glutInit(&argc, argv);
+ glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
+ glutInitWindowSize(600, 600);
+ glutCreateWindow(argv[0]);
+ glewInit();
+ myinit();
+ glutReshapeFunc(myReshape);
+ glutDisplayFunc(display);
+ glutKeyboardFunc(key);
+ usage();
+ glutMainLoop();
+ return 0; /* ANSI C requires main to return int. */
}
diff --git a/progs/tests/prog_parameter.c b/progs/tests/prog_parameter.c
index 6dd956c4023..0241f3a2496 100644
--- a/progs/tests/prog_parameter.c
+++ b/progs/tests/prog_parameter.c
@@ -116,7 +116,7 @@ static int set_parameter_batch( GLsizei count, GLfloat * param,
for ( i = 0 ; i < (4 * count) ; i++ ) {
- param[i] = (GLfloat) random() / (GLfloat) random();
+ param[i] = (GLfloat) rand() / (GLfloat) rand();
}
/* Try using the "classic" interface.
@@ -153,7 +153,7 @@ static int set_parameter_batch( GLsizei count, GLfloat * param,
for ( i = 0 ; i < (4 * count) ; i++ ) {
- param[i] = (GLfloat) random() / (GLfloat) random();
+ param[i] = (GLfloat) rand() / (GLfloat) rand();
}
printf("Testing glProgram%sParameters4fvEXT (count = %u)...\n", name, count);
@@ -203,20 +203,20 @@ static void Init( void )
}
- program_local_parameter4fv = glutGetProcAddress( "glProgramLocalParameter4fvARB" );
- program_env_parameter4fv = glutGetProcAddress( "glProgramEnvParameter4fvARB" );
+ program_local_parameter4fv = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) glutGetProcAddress( "glProgramLocalParameter4fvARB" );
+ program_env_parameter4fv = (PFNGLPROGRAMENVPARAMETER4FVARBPROC) glutGetProcAddress( "glProgramEnvParameter4fvARB" );
- get_program_local_parameterfv = glutGetProcAddress( "glGetProgramLocalParameterfvARB" );
- get_program_env_parameterfv = glutGetProcAddress( "glGetProgramEnvParameterfvARB" );
+ get_program_local_parameterfv = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) glutGetProcAddress( "glGetProgramLocalParameterfvARB" );
+ get_program_env_parameterfv = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC) glutGetProcAddress( "glGetProgramEnvParameterfvARB" );
- bind_program = glutGetProcAddress( "glBindProgramARB" );
- get_program = glutGetProcAddress( "glGetProgramivARB" );
+ bind_program = (PFNGLBINDPROGRAMARBPROC) glutGetProcAddress( "glBindProgramARB" );
+ get_program = (PFNGLGETPROGRAMIVARBPROC) glutGetProcAddress( "glGetProgramivARB" );
if ( glutExtensionSupported("GL_EXT_gpu_program_parameters") ) {
printf("GL_EXT_gpu_program_parameters available, testing that path.\n");
- program_local_parameters4fv = glutGetProcAddress( "glProgramLocalParameters4fvEXT" );
- program_env_parameters4fv = glutGetProcAddress( "glProgramEnvParameters4fvEXT" );
+ program_local_parameters4fv = (PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) glutGetProcAddress( "glProgramLocalParameters4fvEXT" );
+ program_env_parameters4fv = (PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) glutGetProcAddress( "glProgramEnvParameters4fvEXT" );
}
else {
printf("GL_EXT_gpu_program_parameters not available.\n");
diff --git a/progs/tests/random.c b/progs/tests/random.c
index 4023674c05f..604b4d4088c 100644
--- a/progs/tests/random.c
+++ b/progs/tests/random.c
@@ -257,11 +257,11 @@ RandomPrimitive(void)
Vcount++;
for (i = 0; i < len; i++) {
+ int k = RandomInt(9);
Vbuffer[Vcount].v[0] = RandomFloat(-3, 3);
Vbuffer[Vcount].v[1] = RandomFloat(-3, 3);
Vbuffer[Vcount].v[2] = RandomFloat(-3, 3);
Vbuffer[Vcount].v[3] = RandomFloat(-3, 3);
- int k = RandomInt(9);
switch (k) {
case 0:
glVertex2fv(Vbuffer[Vcount].v);
diff --git a/progs/tests/stencil_twoside.c b/progs/tests/stencil_twoside.c
index 1e18ca6b5ea..7d871e5877f 100644
--- a/progs/tests/stencil_twoside.c
+++ b/progs/tests/stencil_twoside.c
@@ -274,9 +274,9 @@ static void Init( void )
if (atof( ver_string ) < 2.0) {
use20syntax = 0;
}
- stencil_func_separate = glutGetProcAddress( "glStencilFuncSeparate" );
- stencil_func_separate_ati = glutGetProcAddress( "glStencilFuncSeparateATI" );
- stencil_op_separate = glutGetProcAddress( "glStencilOpSeparate" );
+ stencil_func_separate = (PFNGLSTENCILFUNCSEPARATEPROC) glutGetProcAddress( "glStencilFuncSeparate" );
+ stencil_func_separate_ati = (PFNGLSTENCILFUNCSEPARATEATIPROC) glutGetProcAddress( "glStencilFuncSeparateATI" );
+ stencil_op_separate = (PFNGLSTENCILOPSEPARATEPROC) glutGetProcAddress( "glStencilOpSeparate" );
printf("\nAll 5 squares should be the same color.\n");
}
diff --git a/progs/tests/texcmp.c b/progs/tests/texcmp.c
index ebb537272f6..3f2cee6e46d 100644
--- a/progs/tests/texcmp.c
+++ b/progs/tests/texcmp.c
@@ -154,7 +154,7 @@ static void Reshape( int width, int height )
static void ReInit( GLenum TC, TEXTURE *Tx )
{
- GLint rv;
+ GLint rv, v;
if ((Tx->TC == TC) && (Tx->cData != NULL)) {
glCompressedTexImage2DARB(GL_TEXTURE_2D, /* target */
@@ -175,6 +175,12 @@ static void ReInit( GLenum TC, TEXTURE *Tx )
GL_UNSIGNED_BYTE, /* texture type */
Tx->data); /* the texture */
+
+ v = 0;
+ glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
+ GL_TEXTURE_INTERNAL_FORMAT, &v);
+ printf("Requested internal format = 0x%x, actual = 0x%x\n", TC, v);
+
/* okay, now cache the compressed texture */
Tx->TC = TC;
if (Tx->cData != NULL) {
diff --git a/progs/tests/texcomp_image.h b/progs/tests/texcomp_image.h
index e63a56774f3..a3884d4d0df 100644
--- a/progs/tests/texcomp_image.h
+++ b/progs/tests/texcomp_image.h
@@ -1,4 +1,4 @@
-static int ImgSize = 131072;
+#define ImgSize 131072
static unsigned char ImgData[131072] =
{
0x4d, 0xbc, 0x0b, 0xb4, 0xda, 0x0a, 0x78, 0xa8, 0x8d, 0xbc, 0x0c, 0xac, 0x8b, 0x7f, 0xeb, 0xf7, 0x8d, 0xbc, 0xeb, 0xab, 0xba, 0xb7, 0x82, 0xa2, 0x8d, 0xbc, 0x2b, 0xb4, 0xa2, 0xfd, 0xee, 0x2f,