summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/engine.c18
-rw-r--r--progs/demos/fbotexture.c1
-rw-r--r--progs/demos/fire.c8
-rw-r--r--progs/demos/isosurf.c1
-rw-r--r--progs/demos/morph3d.c1
-rw-r--r--progs/egl/xeglgears.c2
-rw-r--r--progs/glsl/convolutions.c2
-rw-r--r--progs/glsl/shtest.c1
-rw-r--r--progs/redbook/aapoly.c1
-rw-r--r--progs/tests/getprocaddress.c4
-rw-r--r--progs/tests/interleave.c2
-rw-r--r--progs/tests/texwrap.c2
-rw-r--r--progs/tests/vparray.c3
-rw-r--r--progs/trivial/Makefile1
-rw-r--r--progs/trivial/SConscript1
-rw-r--r--progs/trivial/tri-fbo-tex-mip.c1
-rw-r--r--progs/trivial/tri-fbo-tex.c2
-rw-r--r--progs/trivial/tri-point-line-clipped.c116
-rw-r--r--progs/xdemos/corender.c1
-rw-r--r--progs/xdemos/manywin.c2
20 files changed, 149 insertions, 21 deletions
diff --git a/progs/demos/engine.c b/progs/demos/engine.c
index c54e3b8fb8..7e485111da 100644
--- a/progs/demos/engine.c
+++ b/progs/demos/engine.c
@@ -120,7 +120,11 @@ static Engine Engines[NUM_ENGINES] =
0.3, /* CrankJournalRadius */
0.4, /* CrankJournalLength */
1.5, /* ConnectingRodLength */
- 0.1 /* ConnectingRodThickness */
+ 0.1, /* ConnectingRodThickness */
+ 0, /* CrankList */
+ 0, /* ConnRodList */
+ 0, /* PistonList */
+ 0 /* BlockList */
},
{
"Inline-4",
@@ -136,7 +140,11 @@ static Engine Engines[NUM_ENGINES] =
0.3, /* CrankJournalRadius */
0.4, /* CrankJournalLength */
1.5, /* ConnectingRodLength */
- 0.1 /* ConnectingRodThickness */
+ 0.1, /* ConnectingRodThickness */
+ 0, /* CrankList */
+ 0, /* ConnRodList */
+ 0, /* PistonList */
+ 0 /* BlockList */
},
{
"Boxer-6",
@@ -152,7 +160,11 @@ static Engine Engines[NUM_ENGINES] =
0.3, /* CrankJournalRadius */
0.4, /* CrankJournalLength */
1.5, /* ConnectingRodLength */
- 0.1 /* ConnectingRodThickness */
+ 0.1, /* ConnectingRodThickness */
+ 0, /* CrankList */
+ 0, /* ConnRodList */
+ 0, /* PistonList */
+ 0 /* BlockList */
}
};
diff --git a/progs/demos/fbotexture.c b/progs/demos/fbotexture.c
index 56482663dc..46bf1c5f6a 100644
--- a/progs/demos/fbotexture.c
+++ b/progs/demos/fbotexture.c
@@ -14,7 +14,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <math.h>
#include "extfuncs.h"
/* For debug */
diff --git a/progs/demos/fire.c b/progs/demos/fire.c
index 9c351e80e5..bb912fb447 100644
--- a/progs/demos/fire.c
+++ b/progs/demos/fire.c
@@ -726,8 +726,13 @@ main(int ac, char **av)
maxage = 1.0 / dt;
- if (ac == 2)
+ if (ac == 2) {
np = atoi(av[1]);
+ if (np <= 0 || np > 1000000) {
+ fprintf(stderr, "Invalid input.\n");
+ exit(-1);
+ }
+ }
if (ac == 4) {
WIDTH = atoi(av[2]);
@@ -761,6 +766,7 @@ main(int ac, char **av)
assert(np > 0);
p = (part *) malloc(sizeof(part) * np);
+ assert(p);
for (i = 0; i < np; i++)
setnewpart(&p[i]);
diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c
index dbe4d8d172..a5b21ffb5c 100644
--- a/progs/demos/isosurf.c
+++ b/progs/demos/isosurf.c
@@ -27,7 +27,6 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <string.h>
#include <math.h>
#ifdef _WIN32
#include <windows.h>
diff --git a/progs/demos/morph3d.c b/progs/demos/morph3d.c
index 0f8ac426f3..07458eb156 100644
--- a/progs/demos/morph3d.c
+++ b/progs/demos/morph3d.c
@@ -137,7 +137,6 @@ So the angle is:
#endif
#include <GL/glut.h>
#include <math.h>
-#include <string.h>
#define Scale 0.3
diff --git a/progs/egl/xeglgears.c b/progs/egl/xeglgears.c
index 614a625603..9fdf474244 100644
--- a/progs/egl/xeglgears.c
+++ b/progs/egl/xeglgears.c
@@ -604,7 +604,7 @@ event_loop(struct egl_manager *eman, EGLint surface_type, EGLint w, EGLint h)
break;
case EGL_PBUFFER_BIT:
eglWaitClient();
- if (!eglCopyBuffers(eman->xdpy, eman->pbuf, eman->xpix))
+ if (!eglCopyBuffers(eman->dpy, eman->pbuf, eman->xpix))
break;
/* fall through */
case EGL_PIXMAP_BIT:
diff --git a/progs/glsl/convolutions.c b/progs/glsl/convolutions.c
index 350e61bbdc..fdfaf568a2 100644
--- a/progs/glsl/convolutions.c
+++ b/progs/glsl/convolutions.c
@@ -182,7 +182,7 @@ static void fillConvolution(GLint *k,
static void setupConvolution()
{
GLint *kernel = (GLint*)malloc(sizeof(GLint) * 9);
- GLfloat scale;
+ GLfloat scale = 0.0;
GLfloat *vecKer = (GLfloat*)malloc(sizeof(GLfloat) * 9 * 4);
GLuint loc;
GLuint i;
diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c
index 7b1917be1c..520eccfb6d 100644
--- a/progs/glsl/shtest.c
+++ b/progs/glsl/shtest.c
@@ -29,7 +29,6 @@
#include <assert.h>
-#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/progs/redbook/aapoly.c b/progs/redbook/aapoly.c
index b7b2b27090..64d06b7b3d 100644
--- a/progs/redbook/aapoly.c
+++ b/progs/redbook/aapoly.c
@@ -45,7 +45,6 @@
#include <GL/glut.h>
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
GLboolean polySmooth = GL_TRUE;
diff --git a/progs/tests/getprocaddress.c b/progs/tests/getprocaddress.c
index e699baf44b..38ca7000df 100644
--- a/progs/tests/getprocaddress.c
+++ b/progs/tests/getprocaddress.c
@@ -660,8 +660,8 @@ exercise_CompressedTextures(GLenum dimension)
glGetTexLevelParameteriv(dimension, 0, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB,
&queryCompressedSize);
if (queryCompressedSize != sizeof(compressedTexture)) {
- fprintf(stderr, "%s: compressed 3D texture changed size: expected %d, actual %d\n",
- __FUNCTION__, sizeof(compressedTexture), queryCompressedSize);
+ fprintf(stderr, "%s: compressed 3D texture changed size: expected %lu, actual %d\n",
+ __FUNCTION__, (unsigned long) sizeof(compressedTexture), queryCompressedSize);
return GL_FALSE;
}
(*GetCompressedTexImageARB)(dimension, 0, queryCompressedData);
diff --git a/progs/tests/interleave.c b/progs/tests/interleave.c
index 47bf9dfbe5..acf67d02c1 100644
--- a/progs/tests/interleave.c
+++ b/progs/tests/interleave.c
@@ -105,7 +105,7 @@ static const unsigned indicies[12] = {
1, 4, 2
};
-#define NONE { NULL, 0, 0, 0 }
+#define NONE { NULL, 0, 0, 0, sizeof( NULL ) }
#define V2F { v, 2, 2 * sizeof( GLfloat ), GL_FLOAT, sizeof( v[0] ) }
#define V3F { v, 3, 3 * sizeof( GLfloat ), GL_FLOAT, sizeof( v[0] ) }
#define V4F { v, 4, 4 * sizeof( GLfloat ), GL_FLOAT, sizeof( v[0] ) }
diff --git a/progs/tests/texwrap.c b/progs/tests/texwrap.c
index 92c8a2f14c..39c55919dd 100644
--- a/progs/tests/texwrap.c
+++ b/progs/tests/texwrap.c
@@ -71,7 +71,7 @@ static struct wrap_mode modes[] = {
WRAP_EXT ( GL_MIRROR_CLAMP_TO_EDGE_EXT, "GL_ATI_texture_mirror_once",
"GL_EXT_texture_mirror_clamp",
999.0 ),
- { 0 }
+ { 0, NULL, GL_FALSE, 0.0, { NULL, NULL } }
};
static void
diff --git a/progs/tests/vparray.c b/progs/tests/vparray.c
index fe168c6cd5..75160afd46 100644
--- a/progs/tests/vparray.c
+++ b/progs/tests/vparray.c
@@ -8,7 +8,6 @@
#include <assert.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
@@ -183,7 +182,7 @@ static void init_program(void)
static const GLfloat bias[4] = {1.0, 1.0, 1.0, 0.0};
if (!glutExtensionSupported("GL_NV_vertex_program")) {
- printf("Sorry, this program requires GL_NV_vertex_program");
+ printf("Sorry, this program requires GL_NV_vertex_program\n");
exit(1);
}
diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile
index e15ec33ab5..5e08d60389 100644
--- a/progs/trivial/Makefile
+++ b/progs/trivial/Makefile
@@ -119,6 +119,7 @@ SOURCES = \
tri-lit-material.c \
tri-mask-tri.c \
tri-orig.c \
+ tri-point-line-clipped.c \
tri-query.c \
tri-repeat.c \
tri-scissor-tri.c \
diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript
index 613383c77b..e9ed1cb71e 100644
--- a/progs/trivial/SConscript
+++ b/progs/trivial/SConscript
@@ -96,6 +96,7 @@ progs = [
'tri-logicop-xor',
'tri-mask-tri',
'tri-orig',
+ 'tri-point-line-clipped',
'tri-query',
'tri-repeat',
'tri-scissor-tri',
diff --git a/progs/trivial/tri-fbo-tex-mip.c b/progs/trivial/tri-fbo-tex-mip.c
index 0744369501..df4725c7b4 100644
--- a/progs/trivial/tri-fbo-tex-mip.c
+++ b/progs/trivial/tri-fbo-tex-mip.c
@@ -6,7 +6,6 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include <math.h>
/* For debug */
diff --git a/progs/trivial/tri-fbo-tex.c b/progs/trivial/tri-fbo-tex.c
index 8d1f871328..eacb7d577b 100644
--- a/progs/trivial/tri-fbo-tex.c
+++ b/progs/trivial/tri-fbo-tex.c
@@ -6,8 +6,6 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-#include <math.h>
/* For debug */
diff --git a/progs/trivial/tri-point-line-clipped.c b/progs/trivial/tri-point-line-clipped.c
new file mode 100644
index 0000000000..f8c1015f5f
--- /dev/null
+++ b/progs/trivial/tri-point-line-clipped.c
@@ -0,0 +1,116 @@
+/**
+ * Test frustum/user clipping w/ glPolygonMode LINE/POINT.
+ *
+ * The bottom/left and bottom/right verts are outside the frustum and clipped.
+ * The top vertex is clipped by a user clipping plane.
+ *
+ * A filled gray reference triangle is shown underneath the points/lines.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <GL/glut.h>
+
+
+static int win;
+
+
+static void
+ColorTri(void)
+{
+ glBegin(GL_TRIANGLES);
+ glColor3f(1, 0, 0); glVertex3f(-1.5, -0.8, 0.0);
+ glColor3f(0, 1, 0); glVertex3f( 1.5, -0.8, 0.0);
+ glColor3f(0, 0, 1); glVertex3f( 0.0, 0.9, 0.0);
+ glEnd();
+}
+
+
+static void
+GrayTri(void)
+{
+ glColor3f(0.3, 0.3, 0.3);
+ glBegin(GL_TRIANGLES);
+ glVertex3f(-1.5, -0.8, 0.0);
+ glVertex3f( 1.5, -0.8, 0.0);
+ glVertex3f( 0.0, 0.9, 0.0);
+ glEnd();
+}
+
+
+static void
+Draw(void)
+{
+ static const GLdouble plane[4] = { 0, -1.0, 0, 0.5 };
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glPointSize(13.0);
+ glLineWidth(5.0);
+
+ glClipPlane(GL_CLIP_PLANE0, plane);
+ glEnable(GL_CLIP_PLANE0);
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ GrayTri();
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ ColorTri();
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
+ ColorTri();
+
+ glutSwapBuffers();
+}
+
+
+static void Reshape(int width, int height)
+{
+ glViewport(0, 0, (GLint)width, (GLint)height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+ if (key == 27) {
+ glutDestroyWindow(win);
+ exit(0);
+ }
+ else {
+ glutPostRedisplay();
+ }
+}
+
+
+static void
+Init(void)
+{
+ fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+ fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
+ fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
+}
+
+
+int
+main(int argc, char **argv)
+{
+ glutInitWindowSize(300, 300);
+ glutInit(&argc, argv);
+ glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
+ win = glutCreateWindow(*argv);
+ if (!win) {
+ return 1;
+ }
+ Init();
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/progs/xdemos/corender.c b/progs/xdemos/corender.c
index 640c902c13..e706f4b3da 100644
--- a/progs/xdemos/corender.c
+++ b/progs/xdemos/corender.c
@@ -20,7 +20,6 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include <X11/keysym.h>
#include <unistd.h>
#include "ipc.h"
diff --git a/progs/xdemos/manywin.c b/progs/xdemos/manywin.c
index 3b0810b2e5..8ad5c4fe49 100644
--- a/progs/xdemos/manywin.c
+++ b/progs/xdemos/manywin.c
@@ -400,6 +400,8 @@ main(int argc, char *argv[])
}
if (n < 1)
n = 1;
+ if (n > MAX_HEADS)
+ n = MAX_HEADS;
printf("%d windows\n", n);
for (i = 0; i < n; i++) {