diff options
Diffstat (limited to 'progs')
169 files changed, 638 insertions, 214 deletions
diff --git a/progs/.gitignore b/progs/.gitignore new file mode 100644 index 00000000000..cb77d18a4b3 --- /dev/null +++ b/progs/.gitignore @@ -0,0 +1 @@ +*.dSYM diff --git a/progs/Makefile b/progs/Makefile index 3700707dfb1..d5852fa416c 100644 --- a/progs/Makefile +++ b/progs/Makefile @@ -4,7 +4,7 @@ TOP = .. include $(TOP)/configs/current -SUBDIRS = $(PROGRAM_DIRS) +SUBDIRS = "$(strip "$(PROGRAM_DIRS)")" default: message subdirs diff --git a/progs/demos/fslight.c b/progs/demos/fslight.c index f0d76a4a06f..acba3e9583f 100644 --- a/progs/demos/fslight.c +++ b/progs/demos/fslight.c @@ -353,6 +353,7 @@ MakeSphere(void) glNewList(SphereList, GL_COMPILE); gluSphere(obj, 2.0f, 10, 5); glEndList(); + gluDeleteQuadric(obj); } static void diff --git a/progs/demos/ipers.c b/progs/demos/ipers.c index 5d82b0dc924..ed03673cb62 100644 --- a/progs/demos/ipers.c +++ b/progs/demos/ipers.c @@ -133,6 +133,8 @@ initdlists(void) glEndList(); } + + gluDeleteQuadric(obj); } static void diff --git a/progs/demos/morph3d.c b/progs/demos/morph3d.c index 6aca8270ff5..01a06aba0ff 100644 --- a/progs/demos/morph3d.c +++ b/progs/demos/morph3d.c @@ -887,5 +887,6 @@ int main(int argc, char **argv) glutIdleFunc( idle_ ); glutDisplayFunc( draw ); glutMainLoop(); - + + return 0; } diff --git a/progs/demos/projtex.c b/progs/demos/projtex.c index 99154d7bdc8..ad205c74137 100644 --- a/progs/demos/projtex.c +++ b/progs/demos/projtex.c @@ -245,6 +245,9 @@ loadImageTextures(void) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); } glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); + + free(texData3); + free(texData4); } } diff --git a/progs/demos/ray.c b/progs/demos/ray.c index c2d8e4f545e..e9211aa3399 100644 --- a/progs/demos/ray.c +++ b/progs/demos/ray.c @@ -834,6 +834,8 @@ initdlists(void) gluQuadricTexture(obj, GL_TRUE); gluSphere(obj, SPHERE_RADIUS, 16, 16); glEndList(); + + gluDeleteQuadric(obj); } int diff --git a/progs/demos/textures.c b/progs/demos/textures.c index b7bf135d219..d94154a2008 100644 --- a/progs/demos/textures.c +++ b/progs/demos/textures.c @@ -57,7 +57,7 @@ Idle(void) { Xrot = glutGet(GLUT_ELAPSED_TIME) * 0.02; Yrot = glutGet(GLUT_ELAPSED_TIME) * 0.04; - //Zrot += 2.0; + /*Zrot += 2.0;*/ glutPostRedisplay(); } diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index a39818726bd..ed29a2d683d 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -208,7 +208,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/point-position.c b/progs/fp/point-position.c index c0963d7a0b5..1ae753c1d05 100644 --- a/progs/fp/point-position.c +++ b/progs/fp/point-position.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-depth.c b/progs/fp/tri-depth.c index 5488469e806..a9f3a6a5be3 100644 --- a/progs/fp/tri-depth.c +++ b/progs/fp/tri-depth.c @@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-depth2.c b/progs/fp/tri-depth2.c index 6ed23071157..8c4336817be 100644 --- a/progs/fp/tri-depth2.c +++ b/progs/fp/tri-depth2.c @@ -59,7 +59,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-depthwrite.c b/progs/fp/tri-depthwrite.c index 8e4f3e62451..7b9d70f292a 100644 --- a/progs/fp/tri-depthwrite.c +++ b/progs/fp/tri-depthwrite.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-depthwrite2.c b/progs/fp/tri-depthwrite2.c index 3c0b4d30c97..599949551d1 100644 --- a/progs/fp/tri-depthwrite2.c +++ b/progs/fp/tri-depthwrite2.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-param.c b/progs/fp/tri-param.c index 57443d71bd0..26a804d4b38 100644 --- a/progs/fp/tri-param.c +++ b/progs/fp/tri-param.c @@ -54,7 +54,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/fp/tri-tex.c b/progs/fp/tri-tex.c index 1dbbb201cef..64299e94531 100644 --- a/progs/fp/tri-tex.c +++ b/progs/fp/tri-tex.c @@ -76,7 +76,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/glsl/CH18-mandel.frag b/progs/glsl/CH18-mandel.frag index a472d812526..a972d68bcfb 100644 --- a/progs/glsl/CH18-mandel.frag +++ b/progs/glsl/CH18-mandel.frag @@ -31,7 +31,7 @@ void main() float iter; // for (iter = 0.0; iter < MaxIterations && r2 < 4.0; ++iter) - for (iter = 0.0; iter < 12 && r2 < 4.0; ++iter) + for (iter = 0.0; iter < 12.0 && r2 < 4.0; ++iter) { float tempreal = real; diff --git a/progs/glsl/bump.c b/progs/glsl/bump.c index 87669aec736..50a0900f1c7 100644 --- a/progs/glsl/bump.c +++ b/progs/glsl/bump.c @@ -36,7 +36,7 @@ static GLint win = 0; static GLfloat xRot = 20.0f, yRot = 0.0f, zRot = 0.0f; -static GLuint tangentAttrib; +static GLint tangentAttrib; static GLboolean Anim = GL_FALSE; diff --git a/progs/glsl/convolutions.c b/progs/glsl/convolutions.c index c2fb76e1aa5..350e61bbdc5 100644 --- a/progs/glsl/convolutions.c +++ b/progs/glsl/convolutions.c @@ -369,7 +369,7 @@ static void keyPress(unsigned char key, int x, int y) case 27: exit(0); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/glsl/deriv.c b/progs/glsl/deriv.c index 265a5157154..30f2b75fef7 100644 --- a/progs/glsl/deriv.c +++ b/progs/glsl/deriv.c @@ -140,6 +140,7 @@ MakeSphere(void) glNewList(SphereList, GL_COMPILE); gluSphere(obj, 2.0f, 30, 15); glEndList(); + gluDeleteQuadric(obj); } diff --git a/progs/glsl/multinoise.c b/progs/glsl/multinoise.c index 0d4026e29cf..d504ba1cc4e 100644 --- a/progs/glsl/multinoise.c +++ b/progs/glsl/multinoise.c @@ -22,22 +22,22 @@ static const char *FragShaderText[ 4 ] = { "void main()\n" "{\n" " gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].w ) * 0.5 + 0.5;\n" - " gl_FragColor.a = 1;\n" + " gl_FragColor.a = 1.0;\n" "}\n", "void main()\n" "{\n" " gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xw ) * 0.5 + 0.5;\n" - " gl_FragColor.a = 1;\n" + " gl_FragColor.a = 1.0;\n" "}\n", "void main()\n" "{\n" " gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyw ) * 0.5 + 0.5;\n" - " gl_FragColor.a = 1;\n" + " gl_FragColor.a = 1.0;\n" "}\n", "void main()\n" "{\n" " gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyzw ) * 0.5 + 0.5;\n" - " gl_FragColor.a = 1;\n" + " gl_FragColor.a = 1.0;\n" "}\n" }; @@ -125,6 +125,7 @@ Key(unsigned char key, int x, int y) case 'a': Anim = !Anim; glutIdleFunc(Anim ? Idle : NULL); + break; case 's': Slice -= step; break; @@ -193,7 +194,7 @@ LoadAndCompileShader(GLuint shader, const char *text) GLchar log[1000]; GLsizei len; glGetShaderInfoLog(shader, 1000, &len, log); - fprintf(stderr, "noise: problem compiling shader: %s\n", log); + fprintf(stderr, "multinoise: problem compiling shader: %s\n", log); exit(1); } else { diff --git a/progs/glsl/multitex.c b/progs/glsl/multitex.c index bf46fd5210e..49b32253eed 100644 --- a/progs/glsl/multitex.c +++ b/progs/glsl/multitex.c @@ -369,12 +369,9 @@ InitPrograms(void) static void InitGL(void) { - const char *version = (const char *) glGetString(GL_VERSION); + if (!ShadersSupported()) + exit(1); - if (version[0] != '2' || version[1] != '.') { - printf("Warning: this program expects OpenGL 2.0\n"); - /*exit(1);*/ - } printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); printf("Usage:\n"); printf(" a - toggle arrays vs. immediate mode rendering\n"); diff --git a/progs/glsl/noise.c b/progs/glsl/noise.c index fdab263ea6a..1148580ff4d 100644 --- a/progs/glsl/noise.c +++ b/progs/glsl/noise.c @@ -28,7 +28,7 @@ static const char *FragShaderText = " vec4 p;\n" " p.xy = gl_TexCoord[0].xy;\n" " p.z = Slice;\n" - " p.w = 0;\n" + " p.w = 0.0;\n" " vec4 n = noise4(p * scale);\n" " gl_FragColor = n * Scale + Bias;\n" "}\n"; @@ -119,6 +119,7 @@ Key(unsigned char key, int x, int y) case 'a': Anim = !Anim; glutIdleFunc(Anim ? Idle : NULL); + break; case 's': Slice -= step; break; diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c index 628a7dd5b98..9d76e018e37 100644 --- a/progs/glsl/shtest.c +++ b/progs/glsl/shtest.c @@ -627,7 +627,7 @@ Init(void) NumAttribs = GetAttribs(Program, Attribs); PrintAttribs(Attribs); - //assert(glGetError() == 0); + /*assert(glGetError() == 0);*/ glClearColor(0.4f, 0.4f, 0.8f, 0.0f); diff --git a/progs/glsl/texaaline.c b/progs/glsl/texaaline.c index 2e4f932ad60..4ad5a761c67 100644 --- a/progs/glsl/texaaline.c +++ b/progs/glsl/texaaline.c @@ -310,8 +310,10 @@ MakeMipmap(void) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4); - ////glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5); + /* + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5); + */ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); #undef SZ diff --git a/progs/glsl/texdemo1.c b/progs/glsl/texdemo1.c index 5b1913a722b..2076e6aef94 100644 --- a/progs/glsl/texdemo1.c +++ b/progs/glsl/texdemo1.c @@ -400,11 +400,8 @@ InitPrograms(void) static void Init(GLboolean useImageFiles) { - const char *version = (const char *) glGetString(GL_VERSION); - - if (version[0] != '2' || version[1] != '.') { - printf("Warning: this program expects OpenGL 2.0\n"); - /*exit(1);*/ + if (!ShadersSupported()) { + exit(1); } printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); diff --git a/progs/glsl/trirast.c b/progs/glsl/trirast.c index 53bd91ef976..857342636dc 100644 --- a/progs/glsl/trirast.c +++ b/progs/glsl/trirast.c @@ -179,9 +179,9 @@ Init(void) "\n" "void main() {\n" " vec2 p = gl_FragCoord.xy; \n" - " if (crs(v1 - v0, p - v0) >= 0 && \n" - " crs(v2 - v1, p - v1) >= 0 && \n" - " crs(v0 - v2, p - v2) >= 0) \n" + " if (crs(v1 - v0, p - v0) >= 0.0 && \n" + " crs(v2 - v1, p - v1) >= 0.0 && \n" + " crs(v0 - v2, p - v2) >= 0.0) \n" " gl_FragColor = vec4(1.0); \n" " else \n" " gl_FragColor = vec4(0.5); \n" diff --git a/progs/redbook/quadric.c b/progs/redbook/quadric.c index 4e46c85f829..7e99098304a 100644 --- a/progs/redbook/quadric.c +++ b/progs/redbook/quadric.c @@ -116,6 +116,8 @@ void init(void) glNewList(startList+3, GL_COMPILE); gluPartialDisk(qobj, 0.0, 1.0, 20, 4, 0.0, 225.0); glEndList(); + + gluDeleteQuadric(qobj); } void display(void) diff --git a/progs/slang/cltest.c b/progs/slang/cltest.c index 2753f59f85b..dfff6cb226a 100644 --- a/progs/slang/cltest.c +++ b/progs/slang/cltest.c @@ -237,7 +237,7 @@ void RenderScene (void) if (p != NULL) p++; } - if (*p != '\0') + if (p && *p != '\0') printf ("*** %s\n", "I/O error"); nextprogram = program->next; diff --git a/progs/slang/vstest.c b/progs/slang/vstest.c index 472ea9b62e2..33c6f09dc55 100644 --- a/progs/slang/vstest.c +++ b/progs/slang/vstest.c @@ -220,6 +220,12 @@ static void load_test_file (const char *filename) fseek (f, 0, SEEK_END); size = ftell (f); + + if (size == -1) { + fclose (f); + return; + } + fseek (f, 0, SEEK_SET); code = (char *) (malloc (size)); diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 2b93aa5464f..197e14d5b00 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -29,6 +29,7 @@ SOURCES = \ blendminmax.c \ blendsquare.c \ blendxor.c \ + blitfb.c \ bufferobj.c \ bumpmap.c \ bug_3050.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/arbgpuprog.c b/progs/tests/arbgpuprog.c index 23aa899d963..6098dca787b 100644 --- a/progs/tests/arbgpuprog.c +++ b/progs/tests/arbgpuprog.c @@ -134,6 +134,8 @@ static void Init( const char *vertProgFile, } len = fread(buf, 1, 10*1000,f); + fclose(f); + glProgramStringARB_func(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, len, @@ -170,6 +172,8 @@ static void Init( const char *vertProgFile, } len = fread(buf, 1, 10*1000,f); + fclose(f); + glProgramStringARB_func(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, len, 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/drawbuffers.c b/progs/tests/drawbuffers.c index d75a870c26b..7a19933e627 100644 --- a/progs/tests/drawbuffers.c +++ b/progs/tests/drawbuffers.c @@ -43,6 +43,8 @@ Display(void) glUseProgram_func(Program); + glEnable(GL_DEPTH_TEST); + /* draw to user framebuffer */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBobject); @@ -68,18 +70,23 @@ Display(void) glPopMatrix(); /* read from user framebuffer */ - /* bottom half = colorbuffer 0 */ + /* left half = colorbuffer 0 */ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); - glReadPixels(0, 0, Width, Height / 2, GL_RGBA, GL_UNSIGNED_BYTE, + glPixelStorei(GL_PACK_ROW_LENGTH, Width); + glPixelStorei(GL_PACK_SKIP_PIXELS, 0); + glReadPixels(0, 0, Width / 2, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - /* top half = colorbuffer 1 */ + + /* right half = colorbuffer 1 */ glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadPixels(0, Height/2, Width, Height - Height / 2, + glPixelStorei(GL_PACK_SKIP_PIXELS, Width / 2); + glReadPixels(Width / 2, 0, Width - Width / 2, Height, GL_RGBA, GL_UNSIGNED_BYTE, - buffer + Width * (Height / 2) * 4); + buffer); /* draw to window */ glUseProgram_func(0); + glDisable(GL_DEPTH_TEST); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glWindowPos2iARB(0, 0); glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); diff --git a/progs/tests/getprocaddress.c b/progs/tests/getprocaddress.c index a09ea58e1da..b905eeaf81b 100644 --- a/progs/tests/getprocaddress.c +++ b/progs/tests/getprocaddress.c @@ -3516,7 +3516,7 @@ check_functions( const char *extensions ) struct name_test_pair *entry; int failures = 0, passes = 0, untested = 0; int totalFail = 0, totalPass = 0, totalUntested = 0, totalUnsupported = 0; - int doTests; + int doTests = 0; const char *version = (const char *) glGetString(GL_VERSION); /* The functions list will have "real" entries (consisting of diff --git a/progs/tests/getteximage.c b/progs/tests/getteximage.c index 71f29b4ac84..e4053b8de1a 100644 --- a/progs/tests/getteximage.c +++ b/progs/tests/getteximage.c @@ -58,6 +58,26 @@ TestGetTexImage(GLboolean npot) abort(); } } + + /* get as BGRA */ + glGetTexImage(GL_TEXTURE_2D, level, GL_BGRA, GL_UNSIGNED_BYTE, data2); + + /* compare */ + { + const GLubyte *rgba = (GLubyte *) data; + const GLubyte *bgra = (GLubyte *) data2; + for (i = 0; i < w * h; i += 4) { + if (rgba[i+0] != bgra[i+2] || + rgba[i+1] != bgra[i+1] || + rgba[i+2] != bgra[i+0] || + rgba[i+3] != bgra[i+3]) { + printf("glTexImage + glGetTexImage(GL_BGRA) failure!\n"); + printf("Expected value %d, found %d\n", data[i], data2[i]); + abort(); + } + } + } + } printf("Passed\n"); diff --git a/progs/tests/mipmap_comp.c b/progs/tests/mipmap_comp.c index 5842e2b8805..dd2232113b6 100644 --- a/progs/tests/mipmap_comp.c +++ b/progs/tests/mipmap_comp.c @@ -285,6 +285,12 @@ main(int argc, char** argv) glutInitWindowSize (600, 600); glutCreateWindow (argv[0]); glewInit(); + + if (!glutExtensionSupported("GL_EXT_texture_compression_s3tc")) { + fprintf(stderr, "This test requires GL_EXT_texture_compression_s3tc.\n"); + exit(1); + } + myInit(); glutReshapeFunc (myReshape); glutDisplayFunc(display); diff --git a/progs/tests/packedpixels.c b/progs/tests/packedpixels.c index 1703b271cb0..c8884bb79f1 100644 --- a/progs/tests/packedpixels.c +++ b/progs/tests/packedpixels.c @@ -17,53 +17,53 @@ struct pixel_format { GLenum format; GLenum type; GLint bytes; - GLuint redTexel, greenTexel; + GLuint redTexel, greenTexel; /* with approx 51% alpha, when applicable */ }; static const struct pixel_format Formats[] = { { "GL_RGBA/GL_UNSIGNED_INT_8_8_8_8", - GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, 4, 0xff000000, 0x00ff0000 }, + GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, 4, 0xff000080, 0x00ff0080 }, { "GL_RGBA/GL_UNSIGNED_INT_8_8_8_8_REV", - GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x000000ff, 0x0000ff00 }, + GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x800000ff, 0x8000ff00 }, { "GL_RGBA/GL_UNSIGNED_INT_10_10_10_2", - GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, 4, 0xffc00000, 0x3ff000 }, + GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, 4, 0xffc00002, 0x3ff002 }, { "GL_RGBA/GL_UNSIGNED_INT_2_10_10_10_REV", - GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, 4, 0x3ff, 0xffc00 }, + GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, 4, 0xc00003ff, 0xc00ffc00 }, { "GL_RGBA/GL_UNSIGNED_SHORT_4_4_4_4", - GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0xf000, 0x0f00 }, + GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0xf008, 0x0f08 }, { "GL_RGBA/GL_UNSIGNED_SHORT_4_4_4_4_REV", - GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x000f, 0x00f0 }, + GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x800f, 0x80f0 }, { "GL_RGBA/GL_UNSIGNED_SHORT_5_5_5_1", - GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0xf800, 0x7c0 }, + GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0xf801, 0x7c1 }, { "GL_RGBA/GL_UNSIGNED_SHORT_1_5_5_5_REV", - GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x1f, 0x3e0 }, + GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x801f, 0x83e0 }, { "GL_BGRA/GL_UNSIGNED_INT_8_8_8_8", - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, 4, 0x0000ff00, 0x00ff0000 }, + GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, 4, 0x0000ff80, 0x00ff0080 }, { "GL_BGRA/GL_UNSIGNED_INT_8_8_8_8_REV", - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x00ff0000, 0x0000ff00 }, + GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x80ff0000, 0x8000ff00 }, { "GL_BGRA/GL_UNSIGNED_SHORT_4_4_4_4", - GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x00f0, 0x0f00 }, + GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x00f8, 0x0f08 }, { "GL_BGRA/GL_UNSIGNED_SHORT_4_4_4_4_REV", - GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x0f00, 0x00f0 }, + GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x8f00, 0x80f0 }, { "GL_BGRA/GL_UNSIGNED_SHORT_5_5_5_1", - GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x3e, 0x7c0 }, + GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x3f, 0x7c1 }, { "GL_BGRA/GL_UNSIGNED_SHORT_1_5_5_5_REV", - GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x7c00, 0x3e0 }, + GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0xfc00, 0x83e0 }, { "GL_ABGR_EXT/GL_UNSIGNED_INT_8_8_8_8", - GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8, 4, 0x000000ff, 0x0000ff00 }, + GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8, 4, 0x800000ff, 0x8000ff00 }, { "GL_ABGR_EXT/GL_UNSIGNED_INT_8_8_8_8_REV", - GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0xff000000, 0x00ff0000 }, + GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0xff000080, 0x00ff0080 }, { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_4_4_4_4", - GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x000f, 0x00f0 }, + GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x800f, 0x80f0 }, { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_4_4_4_4_REV", - GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0xf000, 0x0f00 }, + GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0xf008, 0x0f08 }, { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_5_5_5_1", - GL_ABGR_EXT, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x1, 0x3e }, + GL_ABGR_EXT, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0xf801, 0xf83e }, { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_1_5_5_5_REV", - GL_ABGR_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x8000, 0x7c00 }, + GL_ABGR_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x800f, 0x7c0f }, { "GL_RGB/GL_UNSIGNED_SHORT_5_6_5", GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 2, 0xf800, 0x7e0 }, @@ -108,7 +108,7 @@ static const struct name_format IntFormats[] = { static GLuint CurFormat = 0; static GLboolean Test3D = GL_FALSE; - +static GLboolean Blend = GL_FALSE; static void @@ -191,6 +191,19 @@ MakeTexture(const struct pixel_format *format, GLenum intFormat, GLboolean swap) format->format, format->type, texBuffer); } + if (0) { + GLint r, g, b, a, l, i; + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_LUMINANCE_SIZE, &l); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTENSITY_SIZE, &i); + printf("IntFormat: 0x%x R %d G %d B %d A %d L %d I %d\n", + intFormat, r, g, b, a, l, i); + glGetError(); + } + if (glGetError()) { printf("GL Error for %s\n", format->name); memset(texBuffer, 255, 1000); @@ -221,6 +234,10 @@ Draw(void) glEnable(GL_TEXTURE_3D); else glEnable(GL_TEXTURE_2D); + + if (Blend) + glEnable(GL_BLEND); + glBegin(GL_POLYGON); glTexCoord3f(0, 0, 0.5); glVertex2f(0, 0); glTexCoord3f(1, 0, 0.5); glVertex2f(w, 0); @@ -232,6 +249,9 @@ Draw(void) glDisable(GL_TEXTURE_3D); else glDisable(GL_TEXTURE_2D); + + glDisable(GL_BLEND); + glColor3f(0, 0, 0); glRasterPos2i(8, 6); PrintString(Formats[i].name); @@ -252,7 +272,7 @@ Draw(void) glPushMatrix(); glTranslatef(2, (i + 1) * (h + 2), 0); glRasterPos2i(8, 6); - sprintf(s, "Internal Texture Format [f/F]: %s (%d of %d)", + sprintf(s, "Internal Texture Format [f/F]: %s (%d of %lu)", IntFormats[CurFormat].name, CurFormat + 1, NUM_INT_FORMATS); PrintString(s); glPopMatrix(); @@ -266,6 +286,15 @@ Draw(void) PrintString("Target [2/3]: GL_TEXTURE_2D"); glPopMatrix(); + glPushMatrix(); + glTranslatef(2, (i + 3) * (h + 2), 0); + glRasterPos2i(8, 6); + if (Blend) + PrintString("Blend: Yes"); + else + PrintString("Blend: No"); + glPopMatrix(); + glutSwapBuffers(); } @@ -288,6 +317,9 @@ Key(unsigned char key, int x, int y) (void) x; (void) y; switch (key) { + case 'b': + Blend = !Blend; + break; case 'F': if (CurFormat == 0) CurFormat = NUM_INT_FORMATS - 1; @@ -323,6 +355,7 @@ Init(void) glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } diff --git a/progs/tests/prog_parameter.c b/progs/tests/prog_parameter.c index 28e3b537acd..0241f3a2496 100644 --- a/progs/tests/prog_parameter.c +++ b/progs/tests/prog_parameter.c @@ -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/shader_api.c b/progs/tests/shader_api.c index 6453856345c..fa0a992540c 100644 --- a/progs/tests/shader_api.c +++ b/progs/tests/shader_api.c @@ -8,6 +8,10 @@ #include <GL/glew.h> #include <GL/glut.h> +#ifndef APIENTRY +#define APIENTRY +#endif + static void assert_test(const char *file, int line, int cond, const char *msg) { if (!cond) @@ -42,7 +46,7 @@ static void assert_error_test(const char *file, int line, GLenum expect) #define assert_error(err) assert_error_test(__FILE__, __LINE__, (err)) -static void check_status(GLuint id, GLenum pname, void (*query)(GLuint, GLenum, GLint *)) +static void check_status(GLuint id, GLenum pname, void (APIENTRY *query)(GLuint, GLenum, GLint *)) { GLint status; diff --git a/progs/tests/sharedtex.c b/progs/tests/sharedtex.c index c07ebd719c7..2337b88d3ff 100644 --- a/progs/tests/sharedtex.c +++ b/progs/tests/sharedtex.c @@ -424,13 +424,13 @@ main(int argc, char *argv[]) { const char *dpyName = XDisplayName(NULL); - struct window *h0, *h1, *h2, *h3; + struct window *h0; /* four windows and contexts sharing display lists and texture objects */ h0 = AddWindow(dpyName, 10, 10, NULL); - h1 = AddWindow(dpyName, 330, 10, h0); - h2 = AddWindow(dpyName, 10, 350, h0); - h3 = AddWindow(dpyName, 330, 350, h0); + (void) AddWindow(dpyName, 330, 10, h0); + (void) AddWindow(dpyName, 10, 350, h0); + (void) AddWindow(dpyName, 330, 350, h0); InitGLstuff(h0); 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 d1e829d1b73..c5d352fdaed 100644 --- a/progs/tests/texcmp.c +++ b/progs/tests/texcmp.c @@ -106,6 +106,8 @@ static void Display( void ) glRotatef(Rot, 0, 0, 1); glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBegin(GL_POLYGON); glTexCoord2f(0, 1); glVertex2f(-1, -0.5); glTexCoord2f(1, 1); glVertex2f( 1, -0.5); @@ -115,7 +117,10 @@ static void Display( void ) glPopMatrix(); + glDisable(GL_TEXTURE_2D); + /* info */ + glDisable(GL_BLEND); glColor4f(1, 1, 1, 1); glRasterPos3f(-1.2, -0.7, 0); @@ -149,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 */ @@ -170,6 +175,24 @@ 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); + + if (0) { + GLint r, g, b, a, l, i; + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_LUMINANCE_SIZE, &l); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTENSITY_SIZE, &i); + printf("Compressed Bits per R: %d G: %d B: %d A: %d L: %d I: %d\n", + r, g, b, a, l, i); + } + /* okay, now cache the compressed texture */ Tx->TC = TC; if (Tx->cData != NULL) { diff --git a/progs/tests/texcompsub.c b/progs/tests/texcompsub.c index 50106bf1e22..215f5711d95 100644 --- a/progs/tests/texcompsub.c +++ b/progs/tests/texcompsub.c @@ -35,6 +35,8 @@ LoadCompressedImage(void) unsigned char ImgDataTemp[ImgSize / 4]; unsigned i; const GLenum filter = GL_LINEAR; + const int half = ImgSize / 2; + glTexImage2D(Target, 0, CompFormat, ImgWidth, ImgHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); @@ -42,11 +44,11 @@ LoadCompressedImage(void) glCompressedTexSubImage2DARB(Target, 0, 0, 0, /* pos */ ImgWidth, ImgHeight / 2, - CompFormat, ImgSize / 2, ImgData + ImgSize / 2); + CompFormat, ImgSize / 2, ImgData /*+ ImgSize / 2*/); /* top left */ for (i = 0; i < ImgHeight / 8; i++) { - memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[i * 2 * ImgWidth], ImgWidth); + memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[half + i * 2 * ImgWidth], ImgWidth); } glCompressedTexSubImage2DARB(Target, 0, 0, ImgHeight / 2, /* pos */ @@ -55,7 +57,7 @@ LoadCompressedImage(void) /* top right */ for (i = 0; i < ImgHeight / 8; i++) { - memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[i * 2 * ImgWidth + ImgWidth], ImgWidth); + memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[half + i * 2 * ImgWidth + ImgWidth], ImgWidth); } glCompressedTexSubImage2DARB(Target, 0, ImgWidth / 2, ImgHeight / 2, /* pos */ diff --git a/progs/tests/texdown.c b/progs/tests/texdown.c index 7e460458325..e6881d39a0a 100644 --- a/progs/tests/texdown.c +++ b/progs/tests/texdown.c @@ -176,6 +176,8 @@ MeasureDownloadRate(void) orig_getImage = (GLubyte *) malloc(image_bytes + ALIGN); if (!orig_texImage || !orig_getImage) { DownloadRate = 0.0; + free(orig_texImage); + free(orig_getImage); return; } diff --git a/progs/tests/vao-01.c b/progs/tests/vao-01.c index 117fae8bd9e..e4a89cb19db 100644 --- a/progs/tests/vao-01.c +++ b/progs/tests/vao-01.c @@ -124,10 +124,10 @@ static void Init( void ) exit(2); } - bind_vertex_array = glutGetProcAddress( "glBindVertexArrayAPPLE" ); - gen_vertex_arrays = glutGetProcAddress( "glGenVertexArraysAPPLE" ); - delete_vertex_arrays = glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); - is_vertex_array = glutGetProcAddress( "glIsVertexArrayAPPLE" ); + bind_vertex_array = (PFNGLBINDVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glBindVertexArrayAPPLE" ); + gen_vertex_arrays = (PFNGLGENVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glGenVertexArraysAPPLE" ); + delete_vertex_arrays = (PFNGLDELETEVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); + is_vertex_array = (PFNGLISVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glIsVertexArrayAPPLE" ); (*gen_vertex_arrays)( 1, & obj ); diff --git a/progs/tests/vao-02.c b/progs/tests/vao-02.c index 7764ed51061..9f7f5c27792 100644 --- a/progs/tests/vao-02.c +++ b/progs/tests/vao-02.c @@ -125,10 +125,10 @@ static void Init( void ) exit(2); } - bind_vertex_array = glutGetProcAddress( "glBindVertexArrayAPPLE" ); - gen_vertex_arrays = glutGetProcAddress( "glGenVertexArraysAPPLE" ); - delete_vertex_arrays = glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); - is_vertex_array = glutGetProcAddress( "glIsVertexArrayAPPLE" ); + bind_vertex_array = (PFNGLBINDVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glBindVertexArrayAPPLE" ); + gen_vertex_arrays = (PFNGLGENVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glGenVertexArraysAPPLE" ); + delete_vertex_arrays = (PFNGLDELETEVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); + is_vertex_array = (PFNGLISVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glIsVertexArrayAPPLE" ); (*gen_vertex_arrays)( 1, & obj ); diff --git a/progs/tests/zreaddraw.c b/progs/tests/zreaddraw.c index 7dfed20cfb9..7740695bb66 100644 --- a/progs/tests/zreaddraw.c +++ b/progs/tests/zreaddraw.c @@ -58,6 +58,10 @@ static void Display(void) printf("Depth value range: [%f, %f]\n", min, max); } + /* Draw the Z image as luminance above original rendering */ + glWindowPos2i(0, 100); + glDrawPixels(100, 100, GL_LUMINANCE, depthType, depth); + if (TestPacking) { glPixelStorei(GL_PACK_ROW_LENGTH, 0); glPixelStorei(GL_PACK_SKIP_PIXELS, 0); @@ -100,6 +104,7 @@ static void Display(void) glReadPixels(100, 0, 400, 400, GL_DEPTH_COMPONENT, GL_FLOAT, depth2); /* draw as luminance */ glPixelZoom(1.0, 1.0); + glWindowPos2i(100, 0); glDrawPixels(400, 400, GL_LUMINANCE, GL_FLOAT, depth2); glutSwapBuffers(); diff --git a/progs/trivial/clear-fbo-tex.c b/progs/trivial/clear-fbo-tex.c index a206676e48e..238f634bf59 100644 --- a/progs/trivial/clear-fbo-tex.c +++ b/progs/trivial/clear-fbo-tex.c @@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/clear-fbo.c b/progs/trivial/clear-fbo.c index 0aeb45489f2..6435c901adc 100644 --- a/progs/trivial/clear-fbo.c +++ b/progs/trivial/clear-fbo.c @@ -73,7 +73,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/clear-random.c b/progs/trivial/clear-random.c index e3da23a8f55..ab67f84518d 100644 --- a/progs/trivial/clear-random.c +++ b/progs/trivial/clear-random.c @@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(0); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/clear-scissor.c b/progs/trivial/clear-scissor.c index 01735327480..2b6dee77a96 100644 --- a/progs/trivial/clear-scissor.c +++ b/progs/trivial/clear-scissor.c @@ -38,7 +38,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/trivial/clear.c b/progs/trivial/clear.c index 03857b4b893..56c3ea52e6a 100644 --- a/progs/trivial/clear.c +++ b/progs/trivial/clear.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(0); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/createwin.c b/progs/trivial/createwin.c index f2cc6f1cffc..04a088642b8 100644 --- a/progs/trivial/createwin.c +++ b/progs/trivial/createwin.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-begin-call-end.c b/progs/trivial/dlist-begin-call-end.c index 0d0aed7c729..da3864a02a4 100644 --- a/progs/trivial/dlist-begin-call-end.c +++ b/progs/trivial/dlist-begin-call-end.c @@ -87,7 +87,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-dangling.c b/progs/trivial/dlist-dangling.c index de106280092..756ab93f870 100644 --- a/progs/trivial/dlist-dangling.c +++ b/progs/trivial/dlist-dangling.c @@ -74,7 +74,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-edgeflag-dangling.c b/progs/trivial/dlist-edgeflag-dangling.c index 3d3aaeb6944..51504471e2c 100644 --- a/progs/trivial/dlist-edgeflag-dangling.c +++ b/progs/trivial/dlist-edgeflag-dangling.c @@ -76,7 +76,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-edgeflag.c b/progs/trivial/dlist-edgeflag.c index 8002129ed14..9456b964732 100644 --- a/progs/trivial/dlist-edgeflag.c +++ b/progs/trivial/dlist-edgeflag.c @@ -81,7 +81,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-flat-tri.c b/progs/trivial/dlist-flat-tri.c index c3dd7921e39..3ee9b283a44 100644 --- a/progs/trivial/dlist-flat-tri.c +++ b/progs/trivial/dlist-flat-tri.c @@ -93,7 +93,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-mat-tri.c b/progs/trivial/dlist-mat-tri.c index ed3a4c5981a..d17c4b913b8 100644 --- a/progs/trivial/dlist-mat-tri.c +++ b/progs/trivial/dlist-mat-tri.c @@ -103,7 +103,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-recursive-call.c b/progs/trivial/dlist-recursive-call.c index fe06b2bbd72..90224f63cb2 100644 --- a/progs/trivial/dlist-recursive-call.c +++ b/progs/trivial/dlist-recursive-call.c @@ -118,7 +118,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-tri-flat-tri.c b/progs/trivial/dlist-tri-flat-tri.c index 4dbb7884869..3265a4d6dcd 100644 --- a/progs/trivial/dlist-tri-flat-tri.c +++ b/progs/trivial/dlist-tri-flat-tri.c @@ -99,7 +99,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/dlist-tri-mat-tri.c b/progs/trivial/dlist-tri-mat-tri.c index f69854ae586..053bb124a23 100644 --- a/progs/trivial/dlist-tri-mat-tri.c +++ b/progs/trivial/dlist-tri-mat-tri.c @@ -102,7 +102,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-clip.c b/progs/trivial/line-clip.c index 5276baffd5d..e4e388ed5cd 100644 --- a/progs/trivial/line-clip.c +++ b/progs/trivial/line-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-cull.c b/progs/trivial/line-cull.c index 1e1b77a942c..c531ff132f5 100644 --- a/progs/trivial/line-cull.c +++ b/progs/trivial/line-cull.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-flat.c b/progs/trivial/line-flat.c index 14f0ac07825..e2ddb87b9ef 100644 --- a/progs/trivial/line-flat.c +++ b/progs/trivial/line-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-stipple-wide.c b/progs/trivial/line-stipple-wide.c index 1804ffad3f0..767583bbea5 100644 --- a/progs/trivial/line-stipple-wide.c +++ b/progs/trivial/line-stipple-wide.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-userclip-clip.c b/progs/trivial/line-userclip-clip.c index 8e030b47cea..3265b2c3bfe 100644 --- a/progs/trivial/line-userclip-clip.c +++ b/progs/trivial/line-userclip-clip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-userclip-nop-clip.c b/progs/trivial/line-userclip-nop-clip.c index 6fcd4bcfe73..0198e27807e 100644 --- a/progs/trivial/line-userclip-nop-clip.c +++ b/progs/trivial/line-userclip-nop-clip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-userclip-nop.c b/progs/trivial/line-userclip-nop.c index e59fd133a5f..6c863a3c82b 100644 --- a/progs/trivial/line-userclip-nop.c +++ b/progs/trivial/line-userclip-nop.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-userclip.c b/progs/trivial/line-userclip.c index e30be5580bd..6cfcb6fc732 100644 --- a/progs/trivial/line-userclip.c +++ b/progs/trivial/line-userclip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line-wide.c b/progs/trivial/line-wide.c index b74021dea73..1945712c5d0 100644 --- a/progs/trivial/line-wide.c +++ b/progs/trivial/line-wide.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/line.c b/progs/trivial/line.c index e1d73280bfc..58ab96836f8 100644 --- a/progs/trivial/line.c +++ b/progs/trivial/line.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/lineloop-clip.c b/progs/trivial/lineloop-clip.c index 45fa47491f8..5e6b6217a1a 100644 --- a/progs/trivial/lineloop-clip.c +++ b/progs/trivial/lineloop-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/lineloop.c b/progs/trivial/lineloop.c index c290dbd8cb3..82eccd24f8f 100644 --- a/progs/trivial/lineloop.c +++ b/progs/trivial/lineloop.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip-clip.c b/progs/trivial/linestrip-clip.c index f2528229218..5e90ea2eb05 100644 --- a/progs/trivial/linestrip-clip.c +++ b/progs/trivial/linestrip-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip-flat-stipple.c b/progs/trivial/linestrip-flat-stipple.c index 5caa7244235..bae5c3a1c3b 100644 --- a/progs/trivial/linestrip-flat-stipple.c +++ b/progs/trivial/linestrip-flat-stipple.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip-stipple-wide.c b/progs/trivial/linestrip-stipple-wide.c index 701c82c266a..0296941a0de 100644 --- a/progs/trivial/linestrip-stipple-wide.c +++ b/progs/trivial/linestrip-stipple-wide.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip-stipple.c b/progs/trivial/linestrip-stipple.c index df2eef96b5d..a847d47deeb 100644 --- a/progs/trivial/linestrip-stipple.c +++ b/progs/trivial/linestrip-stipple.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/linestrip.c b/progs/trivial/linestrip.c index 0219b1ab70e..b6d68821463 100644 --- a/progs/trivial/linestrip.c +++ b/progs/trivial/linestrip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point-clip.c b/progs/trivial/point-clip.c index 4c89ba598d7..23cfd778637 100644 --- a/progs/trivial/point-clip.c +++ b/progs/trivial/point-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point-param.c b/progs/trivial/point-param.c index 6f43720a892..46bd773265f 100644 --- a/progs/trivial/point-param.c +++ b/progs/trivial/point-param.c @@ -59,7 +59,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/trivial/point-sprite.c b/progs/trivial/point-sprite.c index 5d29a6a3cf9..16e6771514b 100644 --- a/progs/trivial/point-sprite.c +++ b/progs/trivial/point-sprite.c @@ -96,7 +96,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point-wide-smooth.c b/progs/trivial/point-wide-smooth.c index f6e9b8df5f9..752cb8aee38 100644 --- a/progs/trivial/point-wide-smooth.c +++ b/progs/trivial/point-wide-smooth.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point-wide.c b/progs/trivial/point-wide.c index 8abd64c6a99..3b00ee9e500 100644 --- a/progs/trivial/point-wide.c +++ b/progs/trivial/point-wide.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/point.c b/progs/trivial/point.c index 49959dcc487..8f5299cf6b5 100644 --- a/progs/trivial/point.c +++ b/progs/trivial/point.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly-flat-clip.c b/progs/trivial/poly-flat-clip.c index 5490068b08e..2a968bed40e 100644 --- a/progs/trivial/poly-flat-clip.c +++ b/progs/trivial/poly-flat-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly-flat-unfilled-clip.c b/progs/trivial/poly-flat-unfilled-clip.c index 26b90ef9645..89f4e0656ab 100644 --- a/progs/trivial/poly-flat-unfilled-clip.c +++ b/progs/trivial/poly-flat-unfilled-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly-flat.c b/progs/trivial/poly-flat.c index a4e3cdb6334..33c2e04e0f8 100644 --- a/progs/trivial/poly-flat.c +++ b/progs/trivial/poly-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly-unfilled.c b/progs/trivial/poly-unfilled.c index 2ad443dc159..c8c0d7a9e37 100644 --- a/progs/trivial/poly-unfilled.c +++ b/progs/trivial/poly-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/poly.c b/progs/trivial/poly.c index e5b788ea5be..964eb42d789 100644 --- a/progs/trivial/poly.c +++ b/progs/trivial/poly.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-clip-all-vertices.c b/progs/trivial/quad-clip-all-vertices.c index 60c87fc9ce1..7712d8ca5b7 100644 --- a/progs/trivial/quad-clip-all-vertices.c +++ b/progs/trivial/quad-clip-all-vertices.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-clip.c b/progs/trivial/quad-clip.c index 063de6106a6..2847c9f9608 100644 --- a/progs/trivial/quad-clip.c +++ b/progs/trivial/quad-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-degenerate.c b/progs/trivial/quad-degenerate.c index fdc142bcd61..85e129d4be2 100644 --- a/progs/trivial/quad-degenerate.c +++ b/progs/trivial/quad-degenerate.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-flat.c b/progs/trivial/quad-flat.c index e3147b3b3fe..bed98e31a4e 100644 --- a/progs/trivial/quad-flat.c +++ b/progs/trivial/quad-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-offset-factor.c b/progs/trivial/quad-offset-factor.c index dfe99bbae68..1fc57a54ae7 100644 --- a/progs/trivial/quad-offset-factor.c +++ b/progs/trivial/quad-offset-factor.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-offset-unfilled.c b/progs/trivial/quad-offset-unfilled.c index 06590021fed..62f50fb98cc 100644 --- a/progs/trivial/quad-offset-unfilled.c +++ b/progs/trivial/quad-offset-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-offset-units.c b/progs/trivial/quad-offset-units.c index 922529d977e..1ac2338692f 100644 --- a/progs/trivial/quad-offset-units.c +++ b/progs/trivial/quad-offset-units.c @@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-tex-alpha.c b/progs/trivial/quad-tex-alpha.c index eebaf9170ec..9db6792fad3 100644 --- a/progs/trivial/quad-tex-alpha.c +++ b/progs/trivial/quad-tex-alpha.c @@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-tex-pbo.c b/progs/trivial/quad-tex-pbo.c index ad41a9a22e5..b7aa1db4360 100644 --- a/progs/trivial/quad-tex-pbo.c +++ b/progs/trivial/quad-tex-pbo.c @@ -105,7 +105,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-unfilled-clip.c b/progs/trivial/quad-unfilled-clip.c index 761878bd4b6..d2e87187751 100644 --- a/progs/trivial/quad-unfilled-clip.c +++ b/progs/trivial/quad-unfilled-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-unfilled-stipple.c b/progs/trivial/quad-unfilled-stipple.c index cd7d2769284..8c1737e6756 100644 --- a/progs/trivial/quad-unfilled-stipple.c +++ b/progs/trivial/quad-unfilled-stipple.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad-unfilled.c b/progs/trivial/quad-unfilled.c index d64f17fdf95..b756449d7a8 100644 --- a/progs/trivial/quad-unfilled.c +++ b/progs/trivial/quad-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quad.c b/progs/trivial/quad.c index d360e309d30..582de783d59 100644 --- a/progs/trivial/quad.c +++ b/progs/trivial/quad.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quads.c b/progs/trivial/quads.c index fe11fef207c..de7854a255e 100644 --- a/progs/trivial/quads.c +++ b/progs/trivial/quads.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quadstrip-cont.c b/progs/trivial/quadstrip-cont.c index 329523531aa..44412698dc5 100644 --- a/progs/trivial/quadstrip-cont.c +++ b/progs/trivial/quadstrip-cont.c @@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quadstrip-flat.c b/progs/trivial/quadstrip-flat.c index 228c6c255e5..0e0b3b49fa6 100644 --- a/progs/trivial/quadstrip-flat.c +++ b/progs/trivial/quadstrip-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/quadstrip.c b/progs/trivial/quadstrip.c index d49a9a53020..1be815fb8cd 100644 --- a/progs/trivial/quadstrip.c +++ b/progs/trivial/quadstrip.c @@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/readpixels.c b/progs/trivial/readpixels.c index 5671618446a..b063f179569 100644 --- a/progs/trivial/readpixels.c +++ b/progs/trivial/readpixels.c @@ -39,7 +39,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(0); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/trivial/tri-alpha-tex.c b/progs/trivial/tri-alpha-tex.c index 780ebe6be5b..853d564ae7b 100644 --- a/progs/trivial/tri-alpha-tex.c +++ b/progs/trivial/tri-alpha-tex.c @@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-alpha.c b/progs/trivial/tri-alpha.c index aec1cbb3772..bd1c88ecf8e 100644 --- a/progs/trivial/tri-alpha.c +++ b/progs/trivial/tri-alpha.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-blend-color.c b/progs/trivial/tri-blend-color.c index 92f019259ec..629b35c4abb 100644 --- a/progs/trivial/tri-blend-color.c +++ b/progs/trivial/tri-blend-color.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-clear.c b/progs/trivial/tri-clear.c index f49186bd8ae..e52ed81bf44 100644 --- a/progs/trivial/tri-clear.c +++ b/progs/trivial/tri-clear.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-clip.c b/progs/trivial/tri-clip.c index e1deca1bdcf..3e3879c9859 100644 --- a/progs/trivial/tri-clip.c +++ b/progs/trivial/tri-clip.c @@ -56,7 +56,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); } diff --git a/progs/trivial/tri-cull-both.c b/progs/trivial/tri-cull-both.c index 864be710c2a..809599d4a6d 100644 --- a/progs/trivial/tri-cull-both.c +++ b/progs/trivial/tri-cull-both.c @@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-dlist.c b/progs/trivial/tri-dlist.c index c410be221a7..62d0a965d82 100644 --- a/progs/trivial/tri-dlist.c +++ b/progs/trivial/tri-dlist.c @@ -75,7 +75,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-fbo.c b/progs/trivial/tri-fbo.c index 1ed177ffdfb..089180f97ad 100644 --- a/progs/trivial/tri-fbo.c +++ b/progs/trivial/tri-fbo.c @@ -75,7 +75,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-flat-clip.c b/progs/trivial/tri-flat-clip.c index 2aab5ba00a5..a23f8a382b0 100644 --- a/progs/trivial/tri-flat-clip.c +++ b/progs/trivial/tri-flat-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-flat.c b/progs/trivial/tri-flat.c index ea703ec6f3f..0614321844e 100644 --- a/progs/trivial/tri-flat.c +++ b/progs/trivial/tri-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-fog.c b/progs/trivial/tri-fog.c index 0cea3d32582..7fc254a4675 100644 --- a/progs/trivial/tri-fog.c +++ b/progs/trivial/tri-fog.c @@ -72,7 +72,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-fp-const-imm.c b/progs/trivial/tri-fp-const-imm.c index d2df442abfc..accea62042d 100644 --- a/progs/trivial/tri-fp-const-imm.c +++ b/progs/trivial/tri-fp-const-imm.c @@ -92,7 +92,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-fp.c b/progs/trivial/tri-fp.c index 4d1508120ea..8f933befd3d 100644 --- a/progs/trivial/tri-fp.c +++ b/progs/trivial/tri-fp.c @@ -90,7 +90,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-lit-material.c b/progs/trivial/tri-lit-material.c index ff9fb2c4dd6..16cebb2b984 100644 --- a/progs/trivial/tri-lit-material.c +++ b/progs/trivial/tri-lit-material.c @@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-lit.c b/progs/trivial/tri-lit.c index 15a7ad24c51..26ebd99d917 100644 --- a/progs/trivial/tri-lit.c +++ b/progs/trivial/tri-lit.c @@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-multitex-vbo.c b/progs/trivial/tri-multitex-vbo.c index e319447ac15..ca4edaa5ddc 100644 --- a/progs/trivial/tri-multitex-vbo.c +++ b/progs/trivial/tri-multitex-vbo.c @@ -192,7 +192,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-orig.c b/progs/trivial/tri-orig.c index 5300f59ecec..f86ac52a026 100644 --- a/progs/trivial/tri-orig.c +++ b/progs/trivial/tri-orig.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-query.c b/progs/trivial/tri-query.c index 94956a86f33..8898f182c78 100644 --- a/progs/trivial/tri-query.c +++ b/progs/trivial/tri-query.c @@ -72,7 +72,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-scissor-tri.c b/progs/trivial/tri-scissor-tri.c index 608ebf29cff..d65502d91b9 100644 --- a/progs/trivial/tri-scissor-tri.c +++ b/progs/trivial/tri-scissor-tri.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-square.c b/progs/trivial/tri-square.c index 0b82a1dd8e3..2014bd489c3 100644 --- a/progs/trivial/tri-square.c +++ b/progs/trivial/tri-square.c @@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-stipple.c b/progs/trivial/tri-stipple.c index aa94fa224b7..15a08fec7c8 100644 --- a/progs/trivial/tri-stipple.c +++ b/progs/trivial/tri-stipple.c @@ -77,7 +77,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-tex-3d.c b/progs/trivial/tri-tex-3d.c index 3ccbe125105..073a080d7a7 100644 --- a/progs/trivial/tri-tex-3d.c +++ b/progs/trivial/tri-tex-3d.c @@ -97,7 +97,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-tex.c b/progs/trivial/tri-tex.c index 56afb4748d7..244e1545042 100644 --- a/progs/trivial/tri-tex.c +++ b/progs/trivial/tri-tex.c @@ -94,7 +94,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-tri.c b/progs/trivial/tri-tri.c index f996bd01a16..7bf400793ea 100644 --- a/progs/trivial/tri-tri.c +++ b/progs/trivial/tri-tri.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-clip.c b/progs/trivial/tri-unfilled-clip.c index 2fd894a49a8..585919e16d1 100644 --- a/progs/trivial/tri-unfilled-clip.c +++ b/progs/trivial/tri-unfilled-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-edgeflag.c b/progs/trivial/tri-unfilled-edgeflag.c index 11c21d1bf68..f536f642296 100644 --- a/progs/trivial/tri-unfilled-edgeflag.c +++ b/progs/trivial/tri-unfilled-edgeflag.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-point.c b/progs/trivial/tri-unfilled-point.c index 750a254669a..11e276e1a5b 100644 --- a/progs/trivial/tri-unfilled-point.c +++ b/progs/trivial/tri-unfilled-point.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-smooth.c b/progs/trivial/tri-unfilled-smooth.c index eddae176e5f..fa31667e658 100644 --- a/progs/trivial/tri-unfilled-smooth.c +++ b/progs/trivial/tri-unfilled-smooth.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-tri-lit.c b/progs/trivial/tri-unfilled-tri-lit.c index 1d42b40b713..d6baeb46978 100644 --- a/progs/trivial/tri-unfilled-tri-lit.c +++ b/progs/trivial/tri-unfilled-tri-lit.c @@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-tri.c b/progs/trivial/tri-unfilled-tri.c index 695cc890955..75a70b8a412 100644 --- a/progs/trivial/tri-unfilled-tri.c +++ b/progs/trivial/tri-unfilled-tri.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-userclip-stip.c b/progs/trivial/tri-unfilled-userclip-stip.c index ddc0dffd4f4..02bfa92f835 100644 --- a/progs/trivial/tri-unfilled-userclip-stip.c +++ b/progs/trivial/tri-unfilled-userclip-stip.c @@ -67,7 +67,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled-userclip.c b/progs/trivial/tri-unfilled-userclip.c index 0dec0bfc9b4..11e53fc7cc9 100644 --- a/progs/trivial/tri-unfilled-userclip.c +++ b/progs/trivial/tri-unfilled-userclip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-unfilled.c b/progs/trivial/tri-unfilled.c index b98cb9a842a..afa1058dad4 100644 --- a/progs/trivial/tri-unfilled.c +++ b/progs/trivial/tri-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-userclip.c b/progs/trivial/tri-userclip.c index 8f37e0fae20..5651c738325 100644 --- a/progs/trivial/tri-userclip.c +++ b/progs/trivial/tri-userclip.c @@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-z-9.c b/progs/trivial/tri-z-9.c index 099e89f6f4a..37b9e2f8732 100644 --- a/progs/trivial/tri-z-9.c +++ b/progs/trivial/tri-z-9.c @@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tri-z-eq.c b/progs/trivial/tri-z-eq.c index b81c992f7d1..6bdac474196 100644 --- a/progs/trivial/tri-z-eq.c +++ b/progs/trivial/tri-z-eq.c @@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan-flat-clip.c b/progs/trivial/trifan-flat-clip.c index 199f91a637e..89bc471191e 100644 --- a/progs/trivial/trifan-flat-clip.c +++ b/progs/trivial/trifan-flat-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan-flat-unfilled-clip.c b/progs/trivial/trifan-flat-unfilled-clip.c index ea3e1553872..3a1a226e546 100644 --- a/progs/trivial/trifan-flat-unfilled-clip.c +++ b/progs/trivial/trifan-flat-unfilled-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan-flat.c b/progs/trivial/trifan-flat.c index d69b4887e39..d25abdf49eb 100644 --- a/progs/trivial/trifan-flat.c +++ b/progs/trivial/trifan-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan-unfilled.c b/progs/trivial/trifan-unfilled.c index 91447e4e44d..2e3ff8218f0 100644 --- a/progs/trivial/trifan-unfilled.c +++ b/progs/trivial/trifan-unfilled.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/trifan.c b/progs/trivial/trifan.c index 84eb4172de1..b8a76151148 100644 --- a/progs/trivial/trifan.c +++ b/progs/trivial/trifan.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tristrip-clip.c b/progs/trivial/tristrip-clip.c index 343e2938049..4e6ee1fbca2 100644 --- a/progs/trivial/tristrip-clip.c +++ b/progs/trivial/tristrip-clip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tristrip-flat.c b/progs/trivial/tristrip-flat.c index 02da97efcea..a90b8b6cb68 100644 --- a/progs/trivial/tristrip-flat.c +++ b/progs/trivial/tristrip-flat.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/tristrip.c b/progs/trivial/tristrip.c index 77bf2fad282..29915ff111d 100644 --- a/progs/trivial/tristrip.c +++ b/progs/trivial/tristrip.c @@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/vp-tri-cb-pos.c b/progs/trivial/vp-tri-cb-pos.c index 42bf9806b19..9cbc4d1193a 100644 --- a/progs/trivial/vp-tri-cb-pos.c +++ b/progs/trivial/vp-tri-cb-pos.c @@ -81,7 +81,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/vp-tri-cb-tex.c b/progs/trivial/vp-tri-cb-tex.c index 8290226675e..e543e2ec3fd 100644 --- a/progs/trivial/vp-tri-cb-tex.c +++ b/progs/trivial/vp-tri-cb-tex.c @@ -114,7 +114,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/trivial/vp-tri-invariant.c b/progs/trivial/vp-tri-invariant.c index ff241393659..4dbe95eb9a1 100644 --- a/progs/trivial/vp-tri-invariant.c +++ b/progs/trivial/vp-tri-invariant.c @@ -69,7 +69,7 @@ static void Key(unsigned char key, int x, int y) case 27: exit(1); default: - return; + break; } glutPostRedisplay(); diff --git a/progs/util/readtex.c b/progs/util/readtex.c index 8e923b6eb47..81cb626e911 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -109,6 +109,7 @@ static rawImageRec *RawImageOpen(const char *fileName) raw->file = fopen(baseName + 1, "rb"); if(raw->file == NULL) { perror(fileName); + free(raw); return NULL; } } @@ -129,6 +130,12 @@ static rawImageRec *RawImageOpen(const char *fileName) if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL || raw->tmpB == NULL) { fprintf(stderr, "Out of memory!\n"); + free(raw->tmp); + free(raw->tmpR); + free(raw->tmpG); + free(raw->tmpB); + free(raw->tmpA); + free(raw); return NULL; } @@ -138,6 +145,14 @@ static rawImageRec *RawImageOpen(const char *fileName) raw->rowSize = (GLint *)malloc(x); if (raw->rowStart == NULL || raw->rowSize == NULL) { fprintf(stderr, "Out of memory!\n"); + free(raw->tmp); + free(raw->tmpR); + free(raw->tmpG); + free(raw->tmpB); + free(raw->tmpA); + free(raw->rowStart); + free(raw->rowSize); + free(raw); return NULL; } raw->rleEnd = 512 + (2 * x); @@ -215,6 +230,7 @@ static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final) final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4); if (final->data == NULL) { fprintf(stderr, "Out of memory!\n"); + return; } ptr = final->data; @@ -250,6 +266,7 @@ static TK_RGBImageRec *tkRGBImageLoad(const char *fileName) final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec)); if (final == NULL) { fprintf(stderr, "Out of memory!\n"); + RawImageClose(raw); return NULL; } final->sizeX = raw->sizeX; @@ -305,6 +322,7 @@ GLboolean LoadRGBMipmaps2( const char *imageFile, GLenum target, fprintf(stderr, "Error in LoadRGBMipmaps %d-component images not implemented\n", image->components ); + FreeImage(image); return GL_FALSE; } @@ -356,6 +374,7 @@ GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height, fprintf(stderr, "Error in LoadRGBImage %d-component images not implemented\n", image->components ); + FreeImage(image); return NULL; } @@ -364,8 +383,10 @@ GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height, bytes = image->sizeX * image->sizeY * image->components; buffer = (GLubyte *) malloc(bytes); - if (!buffer) + if (!buffer) { + FreeImage(image); return NULL; + } memcpy( (void *) buffer, (void *) image->data, bytes ); @@ -438,6 +459,7 @@ GLushort *LoadYUVImage( const char *imageFile, GLint *width, GLint *height ) fprintf(stderr, "Error in LoadYUVImage %d-component images not implemented\n", image->components ); + FreeImage(image); return NULL; } diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c index 4db950016b8..2f44c388d8a 100644 --- a/progs/util/shaderutil.c +++ b/progs/util/shaderutil.c @@ -25,7 +25,11 @@ GLboolean ShadersSupported(void) { const char *version = (const char *) glGetString(GL_VERSION); - if (version[0] == '2' && version[1] == '.') { + + /* NVIDIA binary drivers will return "3.0.0", and they clearly support + * shaders. + */ + if (version[0] >= '2' && version[1] == '.') { return GL_TRUE; } else if (glutExtensionSupported("GL_ARB_vertex_shader") @@ -34,7 +38,8 @@ ShadersSupported(void) fprintf(stderr, "Warning: Trying ARB GLSL instead of OpenGL 2.x. This may not work.\n"); return GL_TRUE; } - return GL_TRUE; + fprintf(stderr, "Sorry, GLSL not supported with this OpenGL.\n"); + return GL_FALSE; } @@ -84,6 +89,7 @@ CompileShaderFile(GLenum shaderType, const char *filename) f = fopen(filename, "r"); if (!f) { fprintf(stderr, "Unable to open shader file %s\n", filename); + free(buffer); return 0; } @@ -94,6 +100,8 @@ CompileShaderFile(GLenum shaderType, const char *filename) shader = CompileShaderText(shaderType, buffer); } else { + fclose(f); + free(buffer); return 0; } diff --git a/progs/vp/vp-tris.c b/progs/vp/vp-tris.c index 1356242d971..29cd027b00c 100644 --- a/progs/vp/vp-tris.c +++ b/progs/vp/vp-tris.c @@ -99,9 +99,11 @@ static void Init( void ) sz = (GLuint) fread(buf, 1, sizeof(buf), f); if (!feof(f)) { fprintf(stderr, "file too long\n"); + fclose(f); exit(1); } + fclose(f); fprintf(stderr, "%.*s\n", sz, buf); if (strncmp( buf, "!!VP", 4 ) == 0) { diff --git a/progs/vpglsl/psiz-mul.glsl b/progs/vpglsl/psiz-mul.glsl index 77f4a46b520..d2a90d8578e 100644 --- a/progs/vpglsl/psiz-mul.glsl +++ b/progs/vpglsl/psiz-mul.glsl @@ -1,6 +1,6 @@ void main() { gl_FrontColor = gl_Color; - gl_PointSize = 10 * gl_Color.x; + gl_PointSize = 10.0 * gl_Color.x; gl_Position = gl_Vertex; } diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile index 53e1c54ef3c..77f667978ce 100644 --- a/progs/xdemos/Makefile +++ b/progs/xdemos/Makefile @@ -8,6 +8,9 @@ INCDIR = $(TOP)/include LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) +# Add X11 and pthread libs to satisfy GNU gold. +APP_LIB_DEPS += -lX11 -lpthread + LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(APP_LIB_DEPS) PROGS = \ diff --git a/progs/xdemos/corender.c b/progs/xdemos/corender.c index f2b8145e52b..8c705354829 100644 --- a/progs/xdemos/corender.c +++ b/progs/xdemos/corender.c @@ -55,6 +55,7 @@ setup_ipc(void) printf("Waiting for connection from another 'corender'\n"); Sock = AcceptConnection(k); + assert(Sock != -1); printf("Got connection, sending windowID\n"); @@ -186,7 +187,7 @@ redraw(Display *dpy) * Without this glClear(), depth buffer for the second process * is pretty much broken. */ - //glClear(GL_DEPTH_BUFFER_BIT); + /*glClear(GL_DEPTH_BUFFER_BIT);*/ glPushMatrix(); glTranslatef(1, 0, 0); diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c index 445d3ea94b6..b182a3091d1 100644 --- a/progs/xdemos/glxinfo.c +++ b/progs/xdemos/glxinfo.c @@ -427,8 +427,6 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits) int nConfigs; if (!visinfo) - configs = glXChooseFBConfig(dpy, scrnum, fbAttribSingle, &nConfigs); - if (!visinfo) configs = glXChooseFBConfig(dpy, scrnum, fbAttribDouble, &nConfigs); if (configs) { @@ -964,8 +962,10 @@ print_fbconfig_info(Display *dpy, int scrnum, InfoMode mode) /* get list of all fbconfigs on this screen */ fbconfigs = glXGetFBConfigs(dpy, scrnum, &numFBConfigs); - if (numFBConfigs == 0) + if (numFBConfigs == 0) { + XFree(fbconfigs); return; + } printf("%d GLXFBConfigs:\n", numFBConfigs); if (mode == Normal) diff --git a/progs/xdemos/glxpbdemo.c b/progs/xdemos/glxpbdemo.c index 91fd30dcaa6..ecf318ec6a7 100644 --- a/progs/xdemos/glxpbdemo.c +++ b/progs/xdemos/glxpbdemo.c @@ -106,6 +106,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height ) if (0 == nConfigs || !fbConfigs) { printf("Error: glxChooseFBConfig failed\n"); + XFree(fbConfigs); XCloseDisplay(dpy); return 0; } diff --git a/progs/xdemos/offset.c b/progs/xdemos/offset.c index 6c5abf383be..314a4fcdd17 100644 --- a/progs/xdemos/offset.c +++ b/progs/xdemos/offset.c @@ -294,6 +294,7 @@ process_input(Display *dpy, Window win) { default: break; } + break; case ButtonPress: prevx = event.xbutton.x; prevy = event.xbutton.y; diff --git a/progs/xdemos/pbdemo.c b/progs/xdemos/pbdemo.c index 2573209336c..277df729246 100644 --- a/progs/xdemos/pbdemo.c +++ b/progs/xdemos/pbdemo.c @@ -131,6 +131,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height ) fbConfigs = ChooseFBConfig(dpy, screen, fbAttribs[attempt], &nConfigs); if (nConfigs==0 || !fbConfigs) { printf("Note: glXChooseFBConfig(%s) failed\n", fbString[attempt]); + XFree(fbConfigs); continue; } diff --git a/progs/xdemos/pbinfo.c b/progs/xdemos/pbinfo.c index b43adf1bb70..edfa9c1f3b0 100644 --- a/progs/xdemos/pbinfo.c +++ b/progs/xdemos/pbinfo.c @@ -27,6 +27,7 @@ PrintConfigs(Display *dpy, int screen, Bool horizFormat) fbConfigs = GetAllFBConfigs(dpy, screen, &nConfigs); if (!nConfigs || !fbConfigs) { printf("Error: glxGetFBConfigs failed\n"); + XFree(fbConfigs); return; } diff --git a/progs/xdemos/sharedtex_mt.c b/progs/xdemos/sharedtex_mt.c index 07c1bfcc388..f924448cc43 100644 --- a/progs/xdemos/sharedtex_mt.c +++ b/progs/xdemos/sharedtex_mt.c @@ -447,7 +447,7 @@ main(int argc, char *argv[]) const char *dpyName = XDisplayName(NULL); pthread_t t0, t1, t2, t3; struct thread_init_arg tia0, tia1, tia2, tia3; - struct window *h0, *h1, *h2, *h3; + struct window *h0; XInitThreads(); @@ -462,9 +462,9 @@ main(int argc, char *argv[]) /* four windows and contexts sharing display lists and texture objects */ h0 = AddWindow(gDpy, dpyName, 10, 10, gCtx); - h1 = AddWindow(gDpy, dpyName, 330, 10, gCtx); - h2 = AddWindow(gDpy, dpyName, 10, 350, gCtx); - h3 = AddWindow(gDpy, dpyName, 330, 350, gCtx); + (void) AddWindow(gDpy, dpyName, 330, 10, gCtx); + (void) AddWindow(gDpy, dpyName, 10, 350, gCtx); + (void) AddWindow(gDpy, dpyName, 330, 350, gCtx); if (!glXMakeCurrent(gDpy, h0->Win, gCtx)) { Error(dpyName, "glXMakeCurrent failed for init thread."); |