summaryrefslogtreecommitdiffstats
path: root/progs
diff options
context:
space:
mode:
Diffstat (limited to 'progs')
-rw-r--r--progs/SConscript81
-rw-r--r--progs/demos/.gitignore1
-rw-r--r--progs/demos/Makefile1
-rw-r--r--progs/demos/SConscript7
-rw-r--r--progs/demos/arbocclude.c213
-rw-r--r--progs/demos/arbocclude2.c314
-rw-r--r--progs/directfb/.gitignore4
-rw-r--r--progs/directfb/Makefile38
-rw-r--r--progs/directfb/df_gears.c480
-rw-r--r--progs/directfb/df_morph3d.c1013
-rw-r--r--progs/directfb/df_reflect.c489
-rw-r--r--progs/directfb/multi_window.c240
-rw-r--r--progs/egl/Makefile8
-rw-r--r--progs/egl/eglinfo.c39
-rw-r--r--progs/egl/xeglgears.c226
-rwxr-xr-xprogs/fp/Makefile8
-rwxr-xr-xprogs/gallium/python/retrace/interpreter.py5
-rw-r--r--progs/gallium/python/samples/gs.py2
-rw-r--r--progs/gallium/python/samples/tri.py2
-rwxr-xr-xprogs/gallium/python/tests/base.py4
-rw-r--r--progs/gallium/python/tests/regress/fragment-shader/fragment-shader.py2
-rw-r--r--progs/gallium/python/tests/regress/vertex-shader/vertex-shader.py2
-rwxr-xr-xprogs/gallium/python/tests/surface_copy.py16
-rwxr-xr-xprogs/gallium/python/tests/texture_render.py20
-rwxr-xr-xprogs/gallium/python/tests/texture_sample.py24
-rwxr-xr-xprogs/gallium/python/tests/texture_transfer.py16
-rw-r--r--progs/gallium/unit/SConscript20
-rw-r--r--progs/gallium/unit/u_format_test.c242
-rw-r--r--progs/ggi/asc-view.c377
-rw-r--r--progs/ggi/blah2
-rw-r--r--progs/ggi/blat7
-rw-r--r--progs/ggi/box.asc66
-rw-r--r--progs/ggi/cone.asc198
-rw-r--r--progs/ggi/gears.c339
-rw-r--r--progs/ggi/gears2.c390
-rw-r--r--progs/ggi/sphere.asc132
-rw-r--r--progs/ggi/torus.asc264
-rw-r--r--progs/ggi/tube.asc396
-rw-r--r--progs/glsl/Makefile3
-rw-r--r--progs/miniglx/.gitignore6
-rw-r--r--progs/miniglx/Makefile61
-rw-r--r--progs/miniglx/glfbdevtest.c477
-rw-r--r--progs/miniglx/manytex.c381
-rw-r--r--progs/miniglx/miniglxsample.c128
-rw-r--r--progs/miniglx/miniglxtest.c272
-rw-r--r--progs/miniglx/sample_server.c111
-rw-r--r--progs/miniglx/sample_server2.c228
-rw-r--r--progs/miniglx/texline.c267
-rw-r--r--progs/rbug/bin_to_bmp.c2
-rw-r--r--progs/redbook/convolution.c10
-rw-r--r--progs/redbook/histogram.c10
-rw-r--r--progs/redbook/minmax.c11
-rw-r--r--progs/tests/.gitignore1
-rw-r--r--progs/tests/Makefile3
-rw-r--r--progs/tests/SConscript1
-rw-r--r--progs/tests/fbotest1.c6
-rw-r--r--progs/tests/fbotest2.c6
-rw-r--r--progs/tests/fbotest3.c6
-rw-r--r--progs/tests/getprocaddress.py4
-rw-r--r--progs/tests/texwrap.c32
-rw-r--r--progs/tests/zbitmap.c127
-rw-r--r--progs/tools/trace/Makefile2
-rw-r--r--progs/trivial/Makefile8
-rw-r--r--progs/trivial/SConscript2
-rw-r--r--progs/windml/Makefile.ugl68
-rw-r--r--progs/windml/readtex.c365
-rw-r--r--progs/windml/uglaccum.c250
-rw-r--r--progs/windml/uglalldemos.c198
-rw-r--r--progs/windml/uglbounce.c272
-rw-r--r--progs/windml/uglcube.c257
-rw-r--r--progs/windml/ugldrawpix.c437
-rw-r--r--progs/windml/uglflip.c224
-rw-r--r--progs/windml/uglgears.c428
-rw-r--r--progs/windml/uglicotorus.c315
-rw-r--r--progs/windml/uglline.c274
-rw-r--r--progs/windml/uglolympic.c479
-rw-r--r--progs/windml/uglpoint.c277
-rw-r--r--progs/windml/uglstencil.c242
-rw-r--r--progs/windml/uglteapot.c295
-rw-r--r--progs/windml/ugltexcube.c379
-rw-r--r--progs/windml/ugltexcyl.c406
-rw-r--r--progs/windml/wrs_logo.bmpbin196662 -> 0 bytes
-rw-r--r--progs/xdemos/.gitignore1
-rw-r--r--progs/xdemos/Makefile1
-rw-r--r--progs/xdemos/glsync.c11
-rw-r--r--progs/xdemos/glxinfo.c23
-rw-r--r--progs/xdemos/msctest.c13
-rw-r--r--progs/xdemos/omlsync.c267
-rw-r--r--progs/xdemos/vgears.c281
-rw-r--r--progs/xdemos/vindex.c65
-rw-r--r--progs/xdemos/vtest.c82
91 files changed, 1485 insertions, 12278 deletions
diff --git a/progs/SConscript b/progs/SConscript
index 2ec95a282e8..aa6640cf7a6 100644
--- a/progs/SConscript
+++ b/progs/SConscript
@@ -1,8 +1,13 @@
+Import('*')
+
+if env['platform'] == 'embedded':
+ Return()
+
SConscript([
'util/SConscript',
])
-Import('*')
+Import('util')
progs_env = env.Clone()
@@ -15,40 +20,40 @@ if progs_env['platform'] == 'windows':
'gdi32',
])
-if platform != 'embedded':
- # OpenGL
- if progs_env['platform'] == 'windows':
- progs_env.Prepend(LIBS = ['glu32', 'opengl32'])
- else:
- progs_env.Prepend(LIBS = ['GLU', 'GL'])
-
- # Glut
- progs_env.Prepend(LIBPATH = [glut.dir])
- progs_env.Prepend(LIBS = [glut.name])
-
- # GLEW
- progs_env.Prepend(LIBS = [glew])
-
- progs_env.Prepend(CPPPATH = [
- '#progs/util',
- ])
-
- progs_env.Prepend(LIBS = [
- util,
- ])
-
- Export('progs_env')
-
- SConscript([
- 'demos/SConscript',
- 'glsl/SConscript',
- 'redbook/SConscript',
- 'samples/SConscript',
- 'tests/SConscript',
- 'trivial/SConscript',
- 'vp/SConscript',
- 'vpglsl/SConscript',
- 'fp/SConscript',
- 'wgl/SConscript',
- 'perf/SConscript',
- ])
+# OpenGL
+if progs_env['platform'] == 'windows':
+ progs_env.Prepend(LIBS = ['glu32', 'opengl32'])
+else:
+ progs_env.Prepend(LIBS = ['GLU', 'GL'])
+
+# Glut
+progs_env.Prepend(LIBPATH = [glut.dir])
+progs_env.Prepend(LIBS = [glut.name])
+
+# GLEW
+progs_env.Prepend(LIBS = [glew])
+
+progs_env.Prepend(CPPPATH = [
+ '#progs/util',
+])
+
+progs_env.Prepend(LIBS = [
+ util,
+])
+
+Export('progs_env')
+
+SConscript([
+ 'demos/SConscript',
+ 'glsl/SConscript',
+ 'redbook/SConscript',
+ 'samples/SConscript',
+ 'tests/SConscript',
+ 'trivial/SConscript',
+ 'vp/SConscript',
+ 'vpglsl/SConscript',
+ 'fp/SConscript',
+ 'wgl/SConscript',
+ 'perf/SConscript',
+ 'gallium/unit/SConscript',
+])
diff --git a/progs/demos/.gitignore b/progs/demos/.gitignore
index 1b31866a850..aecdd9a0118 100644
--- a/progs/demos/.gitignore
+++ b/progs/demos/.gitignore
@@ -1,6 +1,7 @@
arbfplight
arbfslight
arbocclude
+arbocclude2
bounce
clearspd
copypix
diff --git a/progs/demos/Makefile b/progs/demos/Makefile
index 5b1d2a0b65b..a13a272ce9c 100644
--- a/progs/demos/Makefile
+++ b/progs/demos/Makefile
@@ -15,6 +15,7 @@ PROGS = \
arbfplight \
arbfslight \
arbocclude \
+ arbocclude2 \
bounce \
clearspd \
copypix \
diff --git a/progs/demos/SConscript b/progs/demos/SConscript
index 10d53b50bf5..20ec6a002a7 100644
--- a/progs/demos/SConscript
+++ b/progs/demos/SConscript
@@ -4,14 +4,17 @@ progs = [
'arbfplight',
'arbfslight',
'arbocclude',
+ 'arbocclude2',
'bounce',
'clearspd',
'copypix',
'cubemap',
+ 'dinoshade',
'dissolve',
'drawpix',
'engine',
'fbo_firecube',
+ 'fbotexture',
'fire',
'fogcoord',
'fplight',
@@ -30,6 +33,7 @@ progs = [
'multiarb',
'paltex',
'pointblast',
+ 'projtex',
'ray',
'readpix',
'reflect',
@@ -50,9 +54,6 @@ progs = [
'tunnel2',
'vao_demo',
'winpos',
- 'dinoshade',
- 'fbotexture',
- 'projtex',
]
for prog in progs:
diff --git a/progs/demos/arbocclude.c b/progs/demos/arbocclude.c
index f669a1f26ba..cc787eeb8a7 100644
--- a/progs/demos/arbocclude.c
+++ b/progs/demos/arbocclude.c
@@ -32,11 +32,12 @@
#include <GL/glew.h>
#include <GL/glut.h>
-#define TEST_DISPLAY_LISTS 0
+#define NUM_OCC 10
static GLboolean Anim = GL_TRUE;
-static GLfloat Xpos = 0;
-static GLuint OccQuery;
+static GLfloat Xpos[NUM_OCC], Ypos[NUM_OCC];
+static GLfloat Sign[NUM_OCC];
+static GLuint OccQuery[NUM_OCC];
static GLint Win = 0;
@@ -54,38 +55,43 @@ PrintString(const char *s)
static void Idle(void)
{
static int lastTime = 0;
- static int sign = +1;
int time = glutGet(GLUT_ELAPSED_TIME);
float step;
+ int i;
if (lastTime == 0)
lastTime = time;
else if (time - lastTime < 20) /* 50Hz update */
return;
- step = (time - lastTime) / 1000.0 * sign;
- lastTime = time;
+ for (i = 0; i < NUM_OCC; i++) {
- Xpos += step;
+ step = (time - lastTime) / 1000.0 * Sign[i];
+
+ Xpos[i] += step;
+
+ if (Xpos[i] > 2.5) {
+ Xpos[i] = 2.5;
+ Sign[i] = -1;
+ }
+ else if (Xpos[i] < -2.5) {
+ Xpos[i] = -2.5;
+ Sign[i] = +1;
+ }
- if (Xpos > 2.5) {
- Xpos = 2.5;
- sign = -1;
- }
- else if (Xpos < -2.5) {
- Xpos = -2.5;
- sign = +1;
}
+
+ lastTime = time;
+
glutPostRedisplay();
}
static void Display( void )
{
- GLuint passed;
- GLint ready;
- char s[100];
+ int i;
+ glClearColor(0.25, 0.25, 0.25, 0.0);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
@@ -96,97 +102,84 @@ static void Display( void )
glTranslatef( 0.0, 0.0, -15.0 );
/* draw the occluding polygons */
- glColor3f(0, 0.6, 0.8);
+ glColor3f(0, 0.4, 0.6);
glBegin(GL_QUADS);
- glVertex2f(-1.6, -1.5);
- glVertex2f(-0.4, -1.5);
- glVertex2f(-0.4, 1.5);
- glVertex2f(-1.6, 1.5);
-
- glVertex2f( 0.4, -1.5);
- glVertex2f( 1.6, -1.5);
- glVertex2f( 1.6, 1.5);
- glVertex2f( 0.4, 1.5);
+ glVertex2f(-1.6, -2.5);
+ glVertex2f(-0.4, -2.5);
+ glVertex2f(-0.4, 2.5);
+ glVertex2f(-1.6, 2.5);
+ glVertex2f( 0.4, -2.5);
+ glVertex2f( 1.6, -2.5);
+ glVertex2f( 1.6, 2.5);
+ glVertex2f( 0.4, 2.5);
glEnd();
- /* draw the test polygon with occlusion testing */
- glPushMatrix();
- glTranslatef(Xpos, 0, -0.5);
- glScalef(0.3, 0.3, 1.0);
- glRotatef(-90.0 * Xpos, 0, 0, 1);
-
-#if defined(GL_ARB_occlusion_query)
-#if TEST_DISPLAY_LISTS
- glNewList(10, GL_COMPILE);
- glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery);
- glEndList();
- glCallList(10);
-#else
- glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery);
-#endif
glColorMask(0, 0, 0, 0);
glDepthMask(GL_FALSE);
- glBegin(GL_POLYGON);
- glVertex3f(-1, -1, 0);
- glVertex3f( 1, -1, 0);
- glVertex3f( 1, 1, 0);
- glVertex3f(-1, 1, 0);
- glEnd();
+ /* draw the test polygons with occlusion testing */
+ for (i = 0; i < NUM_OCC; i++) {
+ glPushMatrix();
+ glTranslatef(Xpos[i], Ypos[i], -0.5);
+ glScalef(0.2, 0.2, 1.0);
+ glRotatef(-90.0 * Xpos[i], 0, 0, 1);
+
+ glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery[i]);
+ glBegin(GL_POLYGON);
+ glVertex3f(-1, -1, 0);
+ glVertex3f( 1, -1, 0);
+ glVertex3f( 1, 1, 0);
+ glVertex3f(-1, 1, 0);
+ glEnd();
+ glEndQueryARB(GL_SAMPLES_PASSED_ARB);
+
+ glPopMatrix();
+ }
-#if TEST_DISPLAY_LISTS
- glNewList(11, GL_COMPILE);
- glEndQueryARB(GL_SAMPLES_PASSED_ARB);
- glEndList();
- glCallList(11);
-#else
- glEndQueryARB(GL_SAMPLES_PASSED_ARB);
-#endif
-
- do {
- /* do useful work here, if any */
- glGetQueryObjectivARB(OccQuery, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
- } while (!ready);
- glGetQueryObjectuivARB(OccQuery, GL_QUERY_RESULT_ARB, &passed);
-
- /* turn off occlusion testing */
glColorMask(1, 1, 1, 1);
glDepthMask(GL_TRUE);
-#endif /* GL_ARB_occlusion_query */
-
- /* draw the orange rect, so we can see what's going on */
- glColor3f(0.8, 0.5, 0);
- glBegin(GL_POLYGON);
- glVertex3f(-1, -1, 0);
- glVertex3f( 1, -1, 0);
- glVertex3f( 1, 1, 0);
- glVertex3f(-1, 1, 0);
- glEnd();
- glPopMatrix();
-
-
- /* Print result message */
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-
- glColor3f(1, 1, 1);
-#if defined(GL_ARB_occlusion_query)
- sprintf(s, " %4d Fragments Visible", passed);
- glRasterPos3f(-0.50, -0.7, 0);
- PrintString(s);
- if (!passed) {
- glRasterPos3f(-0.25, -0.8, 0);
- PrintString("Fully Occluded");
+ /* Draw the rectangles now.
+ * Draw orange if result was ready
+ * Draw red if result was not ready.
+ */
+ for (i = 0; i < NUM_OCC; i++) {
+ GLuint passed;
+ GLint ready;
+
+ glGetQueryObjectivARB(OccQuery[i], GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
+
+ glGetQueryObjectuivARB(OccQuery[i], GL_QUERY_RESULT_ARB, &passed);
+
+ if (!ready)
+ glColor3f(1, 0, 0);
+ else
+ glColor3f(0.8, 0.5, 0);
+
+ if (!ready || passed) {
+ glPushMatrix();
+ glTranslatef(Xpos[i], Ypos[i], -0.5);
+ glScalef(0.2, 0.2, 1.0);
+ glRotatef(-90.0 * Xpos[i], 0, 0, 1);
+
+ glBegin(GL_POLYGON);
+ glVertex3f(-1, -1, 0);
+ glVertex3f( 1, -1, 0);
+ glVertex3f( 1, 1, 0);
+ glVertex3f(-1, 1, 0);
+ glEnd();
+
+ glPopMatrix();
+ }
+
+ {
+ char s[10];
+ glRasterPos3f(0.45, Ypos[i], 1.0);
+ sprintf(s, "%4d", passed);
+ PrintString(s);
+ }
}
-#else
- glRasterPos3f(-0.25, -0.8, 0);
- PrintString("GL_ARB_occlusion_query not available at compile time");
-#endif /* GL_ARB_occlusion_query */
glutSwapBuffers();
}
@@ -222,14 +215,17 @@ static void Key( unsigned char key, int x, int y )
static void SpecialKey( int key, int x, int y )
{
const GLfloat step = 0.1;
+ int i;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_LEFT:
- Xpos -= step;
+ for (i = 0; i < NUM_OCC; i++)
+ Xpos[i] -= step;
break;
case GLUT_KEY_RIGHT:
- Xpos += step;
+ for (i = 0; i < NUM_OCC; i++)
+ Xpos[i] += step;
break;
}
glutPostRedisplay();
@@ -240,29 +236,33 @@ static void Init( void )
{
const char *ext = (const char *) glGetString(GL_EXTENSIONS);
GLint bits;
+ int i;
if (!strstr(ext, "GL_ARB_occlusion_query")) {
printf("Sorry, this demo requires the GL_ARB_occlusion_query extension\n");
exit(-1);
}
-#if defined(GL_ARB_occlusion_query)
glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB, &bits);
if (!bits) {
printf("Hmmm, GL_QUERY_COUNTER_BITS_ARB is zero!\n");
exit(-1);
}
-#endif /* GL_ARB_occlusion_query */
glGetIntegerv(GL_DEPTH_BITS, &bits);
printf("Depthbits: %d\n", bits);
-#if defined(GL_ARB_occlusion_query)
- glGenQueriesARB(1, &OccQuery);
- assert(OccQuery > 0);
-#endif /* GL_ARB_occlusion_query */
+ glGenQueriesARB(NUM_OCC, OccQuery);
glEnable(GL_DEPTH_TEST);
+
+ for (i = 0; i < NUM_OCC; i++) {
+ float t = (float) i / (NUM_OCC - 1);
+ Xpos[i] = 2.5 * t;
+ Ypos[i] = 4.0 * (t - 0.5);
+ Sign[i] = 1.0;
+ }
+
}
@@ -276,7 +276,10 @@ int main( int argc, char *argv[] )
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
- glutIdleFunc( Idle );
+ if (Anim)
+ glutIdleFunc(Idle);
+ else
+ glutIdleFunc(NULL);
glutDisplayFunc( Display );
Init();
glutMainLoop();
diff --git a/progs/demos/arbocclude2.c b/progs/demos/arbocclude2.c
new file mode 100644
index 00000000000..195a23803a4
--- /dev/null
+++ b/progs/demos/arbocclude2.c
@@ -0,0 +1,314 @@
+/*
+ * GL_ARB_occlusion_query demo
+ *
+ * Brian Paul
+ * 12 June 2003
+ *
+ * Copyright (C) 2003 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+
+static GLboolean Anim = GL_TRUE;
+static GLfloat Xpos = 0;
+static GLuint OccQuery1;
+static GLuint OccQuery2;
+static GLint Win = 0;
+
+
+static void
+PrintString(const char *s)
+{
+ while (*s) {
+ glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
+ s++;
+ }
+}
+
+
+
+static void Idle(void)
+{
+ static int lastTime = 0;
+ static int sign = +1;
+ int time = glutGet(GLUT_ELAPSED_TIME);
+ float step;
+
+ if (lastTime == 0)
+ lastTime = time;
+ else if (time - lastTime < 20) /* 50Hz update */
+ return;
+
+ step = (time - lastTime) / 1000.0 * sign;
+ lastTime = time;
+
+ Xpos += step;
+
+ if (Xpos > 2.5) {
+ Xpos = 2.5;
+ sign = -1;
+ }
+ else if (Xpos < -2.5) {
+ Xpos = -2.5;
+ sign = +1;
+ }
+ glutPostRedisplay();
+}
+
+
+static void Display( void )
+{
+ GLuint passed1, passed2;
+ GLint ready;
+ char s[100];
+
+ glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+
+ 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 );
+
+ /* draw the occluding polygons */
+ glColor3f(0, 0.6, 0.8);
+ glBegin(GL_QUADS);
+ glVertex2f(-1.6, -1.5);
+ glVertex2f(-0.4, -1.5);
+ glVertex2f(-0.4, 1.5);
+ glVertex2f(-1.6, 1.5);
+
+ glVertex2f( 0.4, -1.5);
+ glVertex2f( 1.6, -1.5);
+ glVertex2f( 1.6, 1.5);
+ glVertex2f( 0.4, 1.5);
+ glEnd();
+
+#if defined(GL_ARB_occlusion_query)
+ glColorMask(0, 0, 0, 0);
+ glDepthMask(GL_FALSE);
+
+ /* draw the first polygon with occlusion testing */
+ glPushMatrix();
+ glTranslatef(Xpos, 0.4, -0.5);
+ glScalef(0.3, 0.3, 1.0);
+ glRotatef(-90.0 * Xpos, 0, 0, 1);
+
+ glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery1);
+
+ glBegin(GL_POLYGON);
+ glVertex3f(-1, -1, 0);
+ glVertex3f( 1, -1, 0);
+ glVertex3f( 1, 1, 0);
+ glVertex3f(-1, 1, 0);
+ glEnd();
+
+ glEndQueryARB(GL_SAMPLES_PASSED_ARB);
+
+ /* draw the second polygon with occlusion testing */
+ glPopMatrix();
+ glPushMatrix();
+ glTranslatef(Xpos, -0.4, -0.5);
+ glScalef(0.3, 0.3, 1.0);
+
+ glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery2);
+
+ glBegin(GL_POLYGON);
+ glVertex3f(-1, -1, 0);
+ glVertex3f( 1, -1, 0);
+ glVertex3f( 1, 1, 0);
+ glVertex3f(-1, 1, 0);
+ glEnd();
+
+ glEndQueryARB(GL_SAMPLES_PASSED_ARB);
+
+ /* turn off occlusion testing */
+ glColorMask(1, 1, 1, 1);
+ glDepthMask(GL_TRUE);
+
+ do {
+ /* do useful work here, if any */
+ glGetQueryObjectivARB(OccQuery1, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
+ } while (!ready);
+ glGetQueryObjectuivARB(OccQuery1, GL_QUERY_RESULT_ARB, &passed1);
+
+ do {
+ /* do useful work here, if any */
+ glGetQueryObjectivARB(OccQuery2, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
+ } while (!ready);
+ glGetQueryObjectuivARB(OccQuery2, GL_QUERY_RESULT_ARB, &passed2);
+#endif /* GL_ARB_occlusion_query */
+
+ /* draw the second rect, so we can see what's going on */
+ glColor3f(0.8, 0.5, 0);
+ glBegin(GL_POLYGON);
+ glVertex3f(-1, -1, 0);
+ glVertex3f( 1, -1, 0);
+ glVertex3f( 1, 1, 0);
+ glVertex3f(-1, 1, 0);
+ glEnd();
+
+ glPopMatrix();
+ glPushMatrix();
+ glTranslatef(Xpos, 0.4, -0.5);
+ glScalef(0.3, 0.3, 1.0);
+ glRotatef(-90.0 * Xpos, 0, 0, 1);
+
+ /* draw the first rect, so we can see what's going on */
+ glBegin(GL_POLYGON);
+ glVertex3f(-1, -1, 0);
+ glVertex3f( 1, -1, 0);
+ glVertex3f( 1, 1, 0);
+ glVertex3f(-1, 1, 0);
+ glEnd();
+
+ glPopMatrix();
+
+ /* Print result message */
+ glMatrixMode( GL_PROJECTION );
+ glLoadIdentity();
+ glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
+ glMatrixMode( GL_MODELVIEW );
+ glLoadIdentity();
+
+ glColor3f(1, 1, 1);
+#if defined(GL_ARB_occlusion_query)
+ sprintf(s, " %4d Fragments Visible", passed1);
+ glRasterPos3f(-0.50, -0.6, 0);
+ PrintString(s);
+ if (!passed1) {
+ glRasterPos3f(-0.25, -0.7, 0);
+ PrintString("Fully Occluded");
+ }
+ sprintf(s, " %4d Fragments Visible", passed2);
+ glRasterPos3f(-0.50, -0.8, 0);
+ PrintString(s);
+ if (!passed2) {
+ glRasterPos3f(-0.25, -0.9, 0);
+ PrintString("Fully Occluded");
+ }
+#else
+ glRasterPos3f(-0.25, -0.8, 0);
+ PrintString("GL_ARB_occlusion_query not available at compile time");
+#endif /* GL_ARB_occlusion_query */
+
+ glutSwapBuffers();
+}
+
+
+static void Reshape( int width, int height )
+{
+ glViewport( 0, 0, width, height );
+}
+
+
+static void Key( unsigned char key, int x, int y )
+{
+ (void) x;
+ (void) y;
+ switch (key) {
+ case 27:
+ glutDestroyWindow(Win);
+ exit(0);
+ break;
+ case ' ':
+ Anim = !Anim;
+ if (Anim)
+ glutIdleFunc(Idle);
+ else
+ glutIdleFunc(NULL);
+ break;
+ }
+ glutPostRedisplay();
+}
+
+
+static void SpecialKey( int key, int x, int y )
+{
+ const GLfloat step = 0.1;
+ (void) x;
+ (void) y;
+ switch (key) {
+ case GLUT_KEY_LEFT:
+ Xpos -= step;
+ break;
+ case GLUT_KEY_RIGHT:
+ Xpos += step;
+ break;
+ }
+ glutPostRedisplay();
+}
+
+
+static void Init( void )
+{
+ const char *ext = (const char *) glGetString(GL_EXTENSIONS);
+ GLint bits;
+
+ if (!strstr(ext, "GL_ARB_occlusion_query")) {
+ printf("Sorry, this demo requires the GL_ARB_occlusion_query extension\n");
+ exit(-1);
+ }
+
+#if defined(GL_ARB_occlusion_query)
+ glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB, &bits);
+ if (!bits) {
+ printf("Hmmm, GL_QUERY_COUNTER_BITS_ARB is zero!\n");
+ exit(-1);
+ }
+#endif /* GL_ARB_occlusion_query */
+
+ glGetIntegerv(GL_DEPTH_BITS, &bits);
+ printf("Depthbits: %d\n", bits);
+
+#if defined(GL_ARB_occlusion_query)
+ glGenQueriesARB(1, &OccQuery1);
+ assert(OccQuery1 > 0);
+ glGenQueriesARB(1, &OccQuery2);
+ assert(OccQuery2 > 0);
+#endif /* GL_ARB_occlusion_query */
+
+ glEnable(GL_DEPTH_TEST);
+}
+
+
+int main( int argc, char *argv[] )
+{
+ glutInitWindowSize( 400, 400 );
+ glutInit( &argc, argv );
+ glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
+ Win = glutCreateWindow(argv[0]);
+ glewInit();
+ glutReshapeFunc( Reshape );
+ glutKeyboardFunc( Key );
+ glutSpecialFunc( SpecialKey );
+ glutIdleFunc( Idle );
+ glutDisplayFunc( Display );
+ Init();
+ glutMainLoop();
+ return 0;
+}
diff --git a/progs/directfb/.gitignore b/progs/directfb/.gitignore
deleted file mode 100644
index 55d65fb5b08..00000000000
--- a/progs/directfb/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-df_gears
-df_morph3d
-df_reflect
-multi_window
diff --git a/progs/directfb/Makefile b/progs/directfb/Makefile
deleted file mode 100644
index 93c2a7df14b..00000000000
--- a/progs/directfb/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-# progs/directfb/Makefile
-
-TOP = ../..
-include $(TOP)/configs/current
-
-
-INCDIR = $(TOP)/include -I$(TOP)/progs
-
-LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME)
-
-CFLAGS += $(shell pkg-config --cflags directfb)
-APP_LIB_DEPS += $(shell pkg-config --libs directfb)
-
-LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
-
-PROGS = df_gears \
- df_reflect \
- df_morph3d \
- multi_window
-
-##### RULES #####
-
-.SUFFIXES:
-.SUFFIXES: .c
-
-.c: $(LIB_DEP)
- $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@
-
-
-##### TARGETS #####
-
-default: $(PROGS)
-
-
-clean:
- -rm -f $(PROGS)
- -rm -f *.o *~
-
diff --git a/progs/directfb/df_gears.c b/progs/directfb/df_gears.c
deleted file mode 100644
index c480767bd33..00000000000
--- a/progs/directfb/df_gears.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- (c) Copyright 2001 convergence integrated media GmbH.
- All rights reserved.
-
- Written by Denis Oliver Kropp <[email protected]> and
- Andreas Hundt <[email protected]>.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include <directfb.h>
-#include <directfbgl.h>
-
-#include <GL/gl.h>
-
-
-/* the super interface */
-IDirectFB *dfb;
-
-/* the primary surface (surface of primary layer) */
-IDirectFBSurface *primary;
-
-/* the GL context */
-IDirectFBGL *primary_gl;
-
-/* our font */
-IDirectFBFont *font;
-
-/* event buffer */
-IDirectFBEventBuffer *events;
-
-/* macro for a safe call to DirectFB functions */
-#define DFBCHECK(x...) \
- { \
- err = x; \
- if (err != DFB_OK) { \
- fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
- DirectFBErrorFatal( #x, err ); \
- } \
- }
-
-static int screen_width, screen_height;
-
-static unsigned long T0 = 0;
-static GLint Frames = 0;
-static GLfloat fps = 0;
-
-static inline unsigned long get_millis()
-{
- struct timeval tv;
-
- gettimeofday (&tv, NULL);
- return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
-}
-
-
-#ifndef M_PI
-#define M_PI 3.14159265
-#endif
-
-/**
-
- Draw a gear wheel. You'll probably want to call this function when
- building a display list since we do a lot of trig here.
-
- Input: inner_radius - radius of hole at center
- outer_radius - radius at center of teeth
- width - width of gear
- teeth - number of teeth
- tooth_depth - depth of tooth
-
- **/
-
-static void
-gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
- GLint teeth, GLfloat tooth_depth)
-{
- GLint i;
- GLfloat r0, r1, r2;
- GLfloat angle, da;
- GLfloat u, v, len;
-
- r0 = inner_radius;
- r1 = outer_radius - tooth_depth / 2.0;
- r2 = outer_radius + tooth_depth / 2.0;
-
- da = 2.0 * M_PI / teeth / 4.0;
-
- glShadeModel(GL_FLAT);
-
- glNormal3f(0.0, 0.0, 1.0);
-
- /* draw front face */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- if (i < teeth) {
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
- }
- }
- glEnd();
-
- /* draw front sides of teeth */
- glBegin(GL_QUADS);
- da = 2.0 * M_PI / teeth / 4.0;
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
- }
- glEnd();
-
- glNormal3f(0.0, 0.0, -1.0);
-
- /* draw back face */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- if (i < teeth) {
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- }
- }
- glEnd();
-
- /* draw back sides of teeth */
- glBegin(GL_QUADS);
- da = 2.0 * M_PI / teeth / 4.0;
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- }
- glEnd();
-
- /* draw outward faces of teeth */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- u = r2 * cos(angle + da) - r1 * cos(angle);
- v = r2 * sin(angle + da) - r1 * sin(angle);
- len = sqrt(u * u + v * v);
- u /= len;
- v /= len;
- glNormal3f(v, -u, 0.0);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
- glNormal3f(cos(angle), sin(angle), 0.0);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
- u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
- v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
- glNormal3f(v, -u, 0.0);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
- glNormal3f(cos(angle), sin(angle), 0.0);
- }
-
- glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
- glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
-
- glEnd();
-
- glShadeModel(GL_SMOOTH);
-
- /* draw inside radius cylinder */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glNormal3f(-cos(angle), -sin(angle), 0.0);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- }
- glEnd();
-
-}
-
-static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
-static GLfloat inc_rotx = 0, inc_roty = 0, inc_rotz = 0;
-static GLint gear1, gear2, gear3;
-static GLfloat angle = 0.0;
-
-static void
-draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix();
- glRotatef(view_rotx, 1.0, 0.0, 0.0);
- glRotatef(view_roty, 0.0, 1.0, 0.0);
- glRotatef(view_rotz, 0.0, 0.0, 1.0);
-
- glPushMatrix();
- glTranslatef(-3.0, -2.0, 0.0);
- glRotatef(angle, 0.0, 0.0, 1.0);
- glCallList(gear1);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(3.1, -2.0, 0.0);
- glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
- glCallList(gear2);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(-3.1, 4.2, 0.0);
- glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
- glCallList(gear3);
- glPopMatrix();
-
- glPopMatrix();
-}
-
-/* new window size or exposure */
-static void
-reshape(int width, int height)
-{
- GLfloat h = (GLfloat) height / (GLfloat) width;
-
- glViewport(0, 0, (GLint) width, (GLint) height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -40.0);
-}
-
-static void
-init(int argc, char *argv[])
-{
- static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0};
- static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
- static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
- static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0};
- GLint i;
-
- glLightfv(GL_LIGHT0, GL_POSITION, pos);
- glEnable(GL_CULL_FACE);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- /* make the gears */
- gear1 = glGenLists(1);
- glNewList(gear1, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
- gear(1.0, 4.0, 1.0, 20, 0.7);
- glEndList();
-
- gear2 = glGenLists(1);
- glNewList(gear2, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
- gear(0.5, 2.0, 2.0, 10, 0.7);
- glEndList();
-
- gear3 = glGenLists(1);
- glNewList(gear3, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
- gear(1.3, 2.0, 0.5, 10, 0.7);
- glEndList();
-
- glEnable(GL_NORMALIZE);
-
- for ( i=1; i<argc; i++ ) {
- if (strcmp(argv[i], "-info")==0) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
- }
-}
-
-int main( int argc, char *argv[] )
-{
- int quit = 0;
- DFBResult err;
- DFBSurfaceDescription dsc;
-
- DFBCHECK(DirectFBInit( &argc, &argv ));
-
- /* create the super interface */
- DFBCHECK(DirectFBCreate( &dfb ));
-
- /* create an event buffer for all devices with these caps */
- DFBCHECK(dfb->CreateInputEventBuffer( dfb, DICAPS_KEYS | DICAPS_AXES,
- DFB_FALSE, &events ));
-
- /* set our cooperative level to DFSCL_FULLSCREEN
- for exclusive access to the primary layer */
- dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
-
- /* get the primary surface, i.e. the surface of the
- primary layer we have exclusive access to */
- dsc.flags = DSDESC_CAPS;
- dsc.caps = DSCAPS_PRIMARY | DSCAPS_DOUBLE;
-
- DFBCHECK(dfb->CreateSurface( dfb, &dsc, &primary ));
-
- /* get the size of the surface and fill it */
- DFBCHECK(primary->GetSize( primary, &screen_width, &screen_height ));
- DFBCHECK(primary->FillRectangle( primary, 0, 0,
- screen_width, screen_height ));
- primary->Flip( primary, NULL, 0 );
-
- /* create the default font and set it */
- DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font ));
- DFBCHECK(primary->SetFont( primary, font ));
-
- /* get the GL context */
- DFBCHECK(primary->GetGL( primary, &primary_gl ));
-
- DFBCHECK(primary_gl->Lock( primary_gl ));
-
- init(argc, argv);
- reshape(screen_width, screen_height);
-
- DFBCHECK(primary_gl->Unlock( primary_gl ));
-
- T0 = get_millis();
-
- while (!quit) {
- DFBInputEvent evt;
- unsigned long t;
-
- DFBCHECK(primary_gl->Lock( primary_gl ));
-
- draw();
-
- DFBCHECK(primary_gl->Unlock( primary_gl ));
-
- if (fps) {
- char buf[64];
-
- snprintf(buf, 64, "%4.1f FPS\n", fps);
-
- primary->SetColor( primary, 0xff, 0, 0, 0xff );
- primary->DrawString( primary, buf, -1, screen_width - 5, 5, DSTF_TOPRIGHT );
- }
-
- primary->Flip( primary, NULL, 0 );
- Frames++;
-
-
- t = get_millis();
- if (t - T0 >= 2000) {
- GLfloat seconds = (t - T0) / 1000.0;
-
- fps = Frames / seconds;
-
- T0 = t;
- Frames = 0;
- }
-
-
- while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) {
- switch (evt.type) {
- case DIET_KEYPRESS:
- switch (evt.key_symbol) {
- case DIKS_ESCAPE:
- quit = 1;
- break;
- case DIKS_CURSOR_UP:
- inc_rotx = 5.0;
- break;
- case DIKS_CURSOR_DOWN:
- inc_rotx = -5.0;
- break;
- case DIKS_CURSOR_LEFT:
- inc_roty = 5.0;
- break;
- case DIKS_CURSOR_RIGHT:
- inc_roty = -5.0;
- break;
- case DIKS_PAGE_UP:
- inc_rotz = 5.0;
- break;
- case DIKS_PAGE_DOWN:
- inc_rotz = -5.0;
- break;
- default:
- ;
- }
- break;
- case DIET_KEYRELEASE:
- switch (evt.key_symbol) {
- case DIKS_CURSOR_UP:
- inc_rotx = 0;
- break;
- case DIKS_CURSOR_DOWN:
- inc_rotx = 0;
- break;
- case DIKS_CURSOR_LEFT:
- inc_roty = 0;
- break;
- case DIKS_CURSOR_RIGHT:
- inc_roty = 0;
- break;
- case DIKS_PAGE_UP:
- inc_rotz = 0;
- break;
- case DIKS_PAGE_DOWN:
- inc_rotz = 0;
- break;
- default:
- ;
- }
- break;
- case DIET_AXISMOTION:
- if (evt.flags & DIEF_AXISREL) {
- switch (evt.axis) {
- case DIAI_X:
- view_roty += evt.axisrel / 2.0;
- break;
- case DIAI_Y:
- view_rotx += evt.axisrel / 2.0;
- break;
- case DIAI_Z:
- view_rotz += evt.axisrel / 2.0;
- break;
- default:
- ;
- }
- }
- break;
- default:
- ;
- }
- }
-
- angle += 2.0;
-
- view_rotx += inc_rotx;
- view_roty += inc_roty;
- view_rotz += inc_rotz;
- }
-
- /* release our interfaces to shutdown DirectFB */
- primary_gl->Release( primary_gl );
- primary->Release( primary );
- font->Release( font );
- events->Release( events );
- dfb->Release( dfb );
-
- return 0;
-}
-
diff --git a/progs/directfb/df_morph3d.c b/progs/directfb/df_morph3d.c
deleted file mode 100644
index 2730fa61569..00000000000
--- a/progs/directfb/df_morph3d.c
+++ /dev/null
@@ -1,1013 +0,0 @@
-/*
- (c) Copyright 2001 convergence integrated media GmbH.
- All rights reserved.
-
- Written by Denis Oliver Kropp <[email protected]> and
- Andreas Hundt <[email protected]>.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-/*-
- * morph3d.c - Shows 3D morphing objects
- *
- * Converted to GLUT by brianp on 1/1/98
- *
- * This program was inspired on a WindowsNT(R)'s screen saver. It was written
- * from scratch and it was not based on any other source code.
- *
- * Porting it to xlock (the final objective of this code since the moment I
- * decided to create it) was possible by comparing the original Mesa's gear
- * demo with it's ported version, so thanks for Danny Sung for his indirect
- * help (look at gear.c in xlock source tree). NOTE: At the moment this code
- * was sent to Brian Paul for package inclusion, the XLock Version was not
- * available. In fact, I'll wait it to appear on the next Mesa release (If you
- * are reading this, it means THIS release) to send it for xlock package
- * inclusion). It will probably there be a GLUT version too.
- *
- * Thanks goes also to Brian Paul for making it possible and inexpensive
- * to use OpenGL at home.
- *
- * Since I'm not a native english speaker, my apologies for any gramatical
- * mistake.
- *
- * My e-mail addresses are
- *
- * and
- *
- * Marcelo F. Vianna (Feb-13-1997)
- */
-
-/*
-This document is VERY incomplete, but tries to describe the mathematics used
-in the program. At this moment it just describes how the polyhedra are
-generated. On futhurer versions, this document will be probabbly improved.
-
-Since I'm not a native english speaker, my apologies for any gramatical
-mistake.
-
-Marcelo Fernandes Vianna
-- Undergraduate in Computer Engeneering at Catholic Pontifical University
-- of Rio de Janeiro (PUC-Rio) Brasil.
-- Feb-13-1997
-
-POLYHEDRA GENERATION
-
-For the purpose of this program it's not sufficient to know the polyhedra
-vertexes coordinates. Since the morphing algorithm applies a nonlinear
-transformation over the surfaces (faces) of the polyhedron, each face has
-to be divided into smaller ones. The morphing algorithm needs to transform
-each vertex of these smaller faces individually. It's a very time consoming
-task.
-
-In order to reduce calculation overload, and since all the macro faces of
-the polyhedron are transformed by the same way, the generation is made by
-creating only one face of the polyhedron, morphing it and then rotating it
-around the polyhedron center.
-
-What we need to know is the face radius of the polyhedron (the radius of
-the inscribed sphere) and the angle between the center of two adjacent
-faces using the center of the sphere as the angle's vertex.
-
-The face radius of the regular polyhedra are known values which I decided
-to not waste my time calculating. Following is a table of face radius for
-the regular polyhedra with edge length = 1:
-
- TETRAHEDRON : 1/(2*sqrt(2))/sqrt(3)
- CUBE : 1/2
- OCTAHEDRON : 1/sqrt(6)
- DODECAHEDRON : T^2 * sqrt((T+2)/5) / 2 -> where T=(sqrt(5)+1)/2
- ICOSAHEDRON : (3*sqrt(3)+sqrt(15))/12
-
-I've not found any reference about the mentioned angles, so I needed to
-calculate them, not a trivial task until I figured out how :)
-Curiously these angles are the same for the tetrahedron and octahedron.
-A way to obtain this value is inscribing the tetrahedron inside the cube
-by matching their vertexes. So you'll notice that the remaining unmatched
-vertexes are in the same straight line starting in the cube/tetrahedron
-center and crossing the center of each tetrahedron's face. At this point
-it's easy to obtain the bigger angle of the isosceles triangle formed by
-the center of the cube and two opposite vertexes on the same cube face.
-The edges of this triangle have the following lenghts: sqrt(2) for the base
-and sqrt(3)/2 for the other two other edges. So the angle we want is:
- +-----------------------------------------------------------+
- | 2*ARCSIN(sqrt(2)/sqrt(3)) = 109.47122063449069174 degrees |
- +-----------------------------------------------------------+
-For the cube this angle is obvious, but just for formality it can be
-easily obtained because we also know it's isosceles edge lenghts:
-sqrt(2)/2 for the base and 1/2 for the other two edges. So the angle we
-want is:
- +-----------------------------------------------------------+
- | 2*ARCSIN((sqrt(2)/2)/1) = 90.000000000000000000 degrees |
- +-----------------------------------------------------------+
-For the octahedron we use the same idea used for the tetrahedron, but now
-we inscribe the cube inside the octahedron so that all cubes's vertexes
-matches excatly the center of each octahedron's face. It's now clear that
-this angle is the same of the thetrahedron one:
- +-----------------------------------------------------------+
- | 2*ARCSIN(sqrt(2)/sqrt(3)) = 109.47122063449069174 degrees |
- +-----------------------------------------------------------+
-For the dodecahedron it's a little bit harder because it's only relationship
-with the cube is useless to us. So we need to solve the problem by another
-way. The concept of Face radius also exists on 2D polygons with the name
-Edge radius:
- Edge Radius For Pentagon (ERp)
- ERp = (1/2)/TAN(36 degrees) * VRp = 0.6881909602355867905
- (VRp is the pentagon's vertex radio).
- Face Radius For Dodecahedron
- FRd = T^2 * sqrt((T+2)/5) / 2 = 1.1135163644116068404
-Why we need ERp? Well, ERp and FRd segments forms a 90 degrees angle,
-completing this triangle, the lesser angle is a half of the angle we are
-looking for, so this angle is:
- +-----------------------------------------------------------+
- | 2*ARCTAN(ERp/FRd) = 63.434948822922009981 degrees |
- +-----------------------------------------------------------+
-For the icosahedron we can use the same method used for dodecahedron (well
-the method used for dodecahedron may be used for all regular polyhedra)
- Edge Radius For Triangle (this one is well known: 1/3 of the triangle height)
- ERt = sin(60)/3 = sqrt(3)/6 = 0.2886751345948128655
- Face Radius For Icosahedron
- FRi= (3*sqrt(3)+sqrt(15))/12 = 0.7557613140761707538
-So the angle is:
- +-----------------------------------------------------------+
- | 2*ARCTAN(ERt/FRi) = 41.810314895778596167 degrees |
- +-----------------------------------------------------------+
-
-*/
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <unistd.h>
-
-#include <directfb.h>
-#include <directfbgl.h>
-
-#include <GL/gl.h>
-
-
-/* the super interface */
-IDirectFB *dfb;
-
-/* the primary surface (surface of primary layer) */
-IDirectFBSurface *primary;
-
-/* the GL context */
-IDirectFBGL *primary_gl;
-
-/* our font */
-IDirectFBFont *font;
-
-/* event buffer */
-IDirectFBEventBuffer *events;
-
-/* macro for a safe call to DirectFB functions */
-#define DFBCHECK(x...) \
- { \
- err = x; \
- if (err != DFB_OK) { \
- fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
- DirectFBErrorFatal( #x, err ); \
- } \
- }
-
-static int screen_width, screen_height;
-
-static unsigned long T0 = 0;
-static GLint Frames = 0;
-static GLfloat fps = 0;
-
-static inline unsigned long get_millis()
-{
- struct timeval tv;
-
- gettimeofday (&tv, NULL);
- return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
-}
-
-
-
-#define Scale 0.3
-
-#define VectMul(X1,Y1,Z1,X2,Y2,Z2) (Y1)*(Z2)-(Z1)*(Y2),(Z1)*(X2)-(X1)*(Z2),(X1)*(Y2)-(Y1)*(X2)
-#define sqr(A) ((A)*(A))
-
-/* Increasing this values produces better image quality, the price is speed. */
-/* Very low values produces erroneous/incorrect plotting */
-#define tetradivisions 23
-#define cubedivisions 20
-#define octadivisions 21
-#define dodecadivisions 10
-#define icodivisions 15
-
-#define tetraangle 109.47122063449069174
-#define cubeangle 90.000000000000000000
-#define octaangle 109.47122063449069174
-#define dodecaangle 63.434948822922009981
-#define icoangle 41.810314895778596167
-
-#ifndef Pi
-#define Pi 3.1415926535897932385
-#endif
-#define SQRT2 1.4142135623730951455
-#define SQRT3 1.7320508075688771932
-#define SQRT5 2.2360679774997898051
-#define SQRT6 2.4494897427831778813
-#define SQRT15 3.8729833462074170214
-#define cossec36_2 0.8506508083520399322
-#define cos72 0.3090169943749474241
-#define sin72 0.9510565162951535721
-#define cos36 0.8090169943749474241
-#define sin36 0.5877852522924731292
-
-/*************************************************************************/
-
-static int mono=0;
-static int smooth=1;
-static GLint WindH, WindW;
-static GLfloat step=0;
-static GLfloat seno;
-static int object;
-static int edgedivisions;
-static void (*draw_object)( void );
-static float Magnitude;
-static float *MaterialColor[20];
-
-static float front_shininess[] = {60.0};
-static float front_specular[] = { 0.7, 0.7, 0.7, 1.0 };
-static float ambient[] = { 0.0, 0.0, 0.0, 1.0 };
-static float diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
-static float position0[] = { 1.0, 1.0, 1.0, 0.0 };
-static float position1[] = {-1.0,-1.0, 1.0, 0.0 };
-static float lmodel_ambient[] = { 0.5, 0.5, 0.5, 1.0 };
-static float lmodel_twoside[] = {GL_TRUE};
-
-static float MaterialRed[] = { 0.7, 0.0, 0.0, 1.0 };
-static float MaterialGreen[] = { 0.1, 0.5, 0.2, 1.0 };
-static float MaterialBlue[] = { 0.0, 0.0, 0.7, 1.0 };
-static float MaterialCyan[] = { 0.2, 0.5, 0.7, 1.0 };
-static float MaterialYellow[] = { 0.7, 0.7, 0.0, 1.0 };
-static float MaterialMagenta[] = { 0.6, 0.2, 0.5, 1.0 };
-static float MaterialWhite[] = { 0.7, 0.7, 0.7, 1.0 };
-static float MaterialGray[] = { 0.2, 0.2, 0.2, 1.0 };
-
-#define TRIANGLE(Edge, Amp, Divisions, Z) \
-{ \
- GLfloat Xf,Yf,Xa,Yb,Xf2,Yf2; \
- GLfloat Factor,Factor1,Factor2; \
- GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \
- GLfloat Ax,Ay,Bx; \
- int Ri,Ti; \
- GLfloat Vr=(Edge)*SQRT3/3; \
- GLfloat AmpVr2=(Amp)/sqr(Vr); \
- GLfloat Zf=(Edge)*(Z); \
- \
- Ax=(Edge)*(+0.5/(Divisions)), Ay=(Edge)*(-SQRT3/(2*Divisions)); \
- Bx=(Edge)*(-0.5/(Divisions)); \
- \
- for (Ri=1; Ri<=(Divisions); Ri++) { \
- glBegin(GL_TRIANGLE_STRIP); \
- for (Ti=0; Ti<Ri; Ti++) { \
- Xf=(float)(Ri-Ti)*Ax + (float)Ti*Bx; \
- Yf=Vr+(float)(Ri-Ti)*Ay + (float)Ti*Ay; \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- \
- Xf=(float)(Ri-Ti-1)*Ax + (float)Ti*Bx; \
- Yf=Vr+(float)(Ri-Ti-1)*Ay + (float)Ti*Ay; \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- \
- } \
- Xf=(float)Ri*Bx; \
- Yf=Vr+(float)Ri*Ay; \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- glEnd(); \
- } \
-}
-
-#define SQUARE(Edge, Amp, Divisions, Z) \
-{ \
- int Xi,Yi; \
- GLfloat Xf,Yf,Y,Xf2,Yf2,Y2,Xa,Yb; \
- GLfloat Factor,Factor1,Factor2; \
- GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \
- GLfloat Zf=(Edge)*(Z); \
- GLfloat AmpVr2=(Amp)/sqr((Edge)*SQRT2/2); \
- \
- for (Yi=0; Yi<(Divisions); Yi++) { \
- Yf=-((Edge)/2.0) + ((float)Yi)/(Divisions)*(Edge); \
- Yf2=sqr(Yf); \
- Y=Yf+1.0/(Divisions)*(Edge); \
- Y2=sqr(Y); \
- glBegin(GL_QUAD_STRIP); \
- for (Xi=0; Xi<=(Divisions); Xi++) { \
- Xf=-((Edge)/2.0) + ((float)Xi)/(Divisions)*(Edge); \
- Xf2=sqr(Xf); \
- \
- Xa=Xf+0.001; Yb=Y+0.001; \
- Factor=1-((Xf2+Y2)*AmpVr2); \
- Factor1=1-((sqr(Xa)+Y2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Y; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Y-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-((Xf2+Yf2)*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- } \
- glEnd(); \
- } \
-}
-
-#define PENTAGON(Edge, Amp, Divisions, Z) \
-{ \
- int Ri,Ti,Fi; \
- GLfloat Xf,Yf,Xa,Yb,Xf2,Yf2; \
- GLfloat x[6],y[6]; \
- GLfloat Factor,Factor1,Factor2; \
- GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \
- GLfloat Zf=(Edge)*(Z); \
- GLfloat AmpVr2=(Amp)/sqr((Edge)*cossec36_2); \
- \
- for(Fi=0;Fi<6;Fi++) { \
- x[Fi]=-cos( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge); \
- y[Fi]=sin( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge); \
- } \
- \
- for (Ri=1; Ri<=(Divisions); Ri++) { \
- for (Fi=0; Fi<5; Fi++) { \
- glBegin(GL_TRIANGLE_STRIP); \
- for (Ti=0; Ti<Ri; Ti++) { \
- Xf=(float)(Ri-Ti)*x[Fi] + (float)Ti*x[Fi+1]; \
- Yf=(float)(Ri-Ti)*y[Fi] + (float)Ti*y[Fi+1]; \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- \
- Xf=(float)(Ri-Ti-1)*x[Fi] + (float)Ti*x[Fi+1]; \
- Yf=(float)(Ri-Ti-1)*y[Fi] + (float)Ti*y[Fi+1]; \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- \
- } \
- Xf=(float)Ri*x[Fi+1]; \
- Yf=(float)Ri*y[Fi+1]; \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- glEnd(); \
- } \
- } \
-}
-
-static void draw_tetra( void )
-{
- GLuint list;
-
- list = glGenLists( 1 );
- glNewList( list, GL_COMPILE );
- TRIANGLE(2,seno,edgedivisions,0.5/SQRT6);
- glEndList();
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-tetraangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+tetraangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+tetraangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
- glCallList(list);
-
- glDeleteLists(list,1);
-}
-
-static void draw_cube( void )
-{
- GLuint list;
-
- list = glGenLists( 1 );
- glNewList( list, GL_COMPILE );
- SQUARE(2, seno, edgedivisions, 0.5)
- glEndList();
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
- glCallList(list);
- glRotatef(cubeangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
- glCallList(list);
- glRotatef(cubeangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
- glCallList(list);
- glRotatef(cubeangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
- glCallList(list);
- glRotatef(cubeangle,0,1,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
- glCallList(list);
- glRotatef(2*cubeangle,0,1,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
- glCallList(list);
-
- glDeleteLists(list,1);
-}
-
-static void draw_octa( void )
-{
- GLuint list;
-
- list = glGenLists( 1 );
- glNewList( list, GL_COMPILE );
- TRIANGLE(2,seno,edgedivisions,1/SQRT6);
- glEndList();
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-180+octaangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-octaangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-octaangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-180+octaangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-octaangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-octaangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]);
- glCallList(list);
-
- glDeleteLists(list,1);
-}
-
-static void draw_dodeca( void )
-{
- GLuint list;
-
-#define TAU ((SQRT5+1)/2)
-
- list = glGenLists( 1 );
- glNewList( list, GL_COMPILE );
- PENTAGON(1,seno,edgedivisions,sqr(TAU) * sqrt((TAU+2)/5) / 2);
- glEndList();
-
- glPushMatrix();
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
- glCallList(list);
- glRotatef(180,0,0,1);
- glPushMatrix();
- glRotatef(-dodecaangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(-dodecaangle,cos72,sin72,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(-dodecaangle,cos72,-sin72,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(dodecaangle,cos36,-sin36,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
- glCallList(list);
- glPopMatrix();
- glRotatef(dodecaangle,cos36,sin36,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]);
- glCallList(list);
- glRotatef(180,0,0,1);
- glPushMatrix();
- glRotatef(-dodecaangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(-dodecaangle,cos72,sin72,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[8]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(-dodecaangle,cos72,-sin72,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[9]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(dodecaangle,cos36,-sin36,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[10]);
- glCallList(list);
- glPopMatrix();
- glRotatef(dodecaangle,cos36,sin36,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[11]);
- glCallList(list);
-
- glDeleteLists(list,1);
-}
-
-static void draw_ico( void )
-{
- GLuint list;
-
- list = glGenLists( 1 );
- glNewList( list, GL_COMPILE );
- TRIANGLE(1.5,seno,edgedivisions,(3*SQRT3+SQRT15)/12);
- glEndList();
-
- glPushMatrix();
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-icoangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-icoangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[8]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-icoangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[9]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[10]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-icoangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[11]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[12]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[13]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[14]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[15]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-icoangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[16]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[17]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[18]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-icoangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[19]);
- glCallList(list);
-
- glDeleteLists(list,1);
-}
-
-static void draw ( void ) {
- glClear( /*GL_COLOR_BUFFER_BIT |*/ GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
-
- glTranslatef( 0.0, 0.0, -10.0 );
- glScalef( Scale*WindH/WindW, Scale, Scale );
- glTranslatef(2.5*WindW/WindH*sin(step*1.11),2.5*cos(step*1.25*1.11),0);
- glRotatef(step*100,1,0,0);
- glRotatef(step*95,0,1,0);
- glRotatef(step*90,0,0,1);
-
- seno=(sin(step)+1.0/3.0)*(4.0/5.0)*Magnitude;
-
- draw_object();
-
- glPopMatrix();
-
- glFlush();
-
- step+=0.05;
-}
-
-static void reshape( int width, int height )
-{
- glViewport(0, 0, WindW=(GLint)width, WindH=(GLint)height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void pinit(void)
-{
- switch(object) {
- case 1:
- draw_object=draw_tetra;
- MaterialColor[0]=MaterialRed;
- MaterialColor[1]=MaterialGreen;
- MaterialColor[2]=MaterialBlue;
- MaterialColor[3]=MaterialWhite;
- edgedivisions=tetradivisions;
- Magnitude=2.5;
- break;
- case 2:
- draw_object=draw_cube;
- MaterialColor[0]=MaterialRed;
- MaterialColor[1]=MaterialGreen;
- MaterialColor[2]=MaterialCyan;
- MaterialColor[3]=MaterialMagenta;
- MaterialColor[4]=MaterialYellow;
- MaterialColor[5]=MaterialBlue;
- edgedivisions=cubedivisions;
- Magnitude=2.0;
- break;
- case 3:
- draw_object=draw_octa;
- MaterialColor[0]=MaterialRed;
- MaterialColor[1]=MaterialGreen;
- MaterialColor[2]=MaterialBlue;
- MaterialColor[3]=MaterialWhite;
- MaterialColor[4]=MaterialCyan;
- MaterialColor[5]=MaterialMagenta;
- MaterialColor[6]=MaterialGray;
- MaterialColor[7]=MaterialYellow;
- edgedivisions=octadivisions;
- Magnitude=2.5;
- break;
- case 4:
- draw_object=draw_dodeca;
- MaterialColor[ 0]=MaterialRed;
- MaterialColor[ 1]=MaterialGreen;
- MaterialColor[ 2]=MaterialCyan;
- MaterialColor[ 3]=MaterialBlue;
- MaterialColor[ 4]=MaterialMagenta;
- MaterialColor[ 5]=MaterialYellow;
- MaterialColor[ 6]=MaterialGreen;
- MaterialColor[ 7]=MaterialCyan;
- MaterialColor[ 8]=MaterialRed;
- MaterialColor[ 9]=MaterialMagenta;
- MaterialColor[10]=MaterialBlue;
- MaterialColor[11]=MaterialYellow;
- edgedivisions=dodecadivisions;
- Magnitude=2.0;
- break;
- case 5:
- draw_object=draw_ico;
- MaterialColor[ 0]=MaterialRed;
- MaterialColor[ 1]=MaterialGreen;
- MaterialColor[ 2]=MaterialBlue;
- MaterialColor[ 3]=MaterialCyan;
- MaterialColor[ 4]=MaterialYellow;
- MaterialColor[ 5]=MaterialMagenta;
- MaterialColor[ 6]=MaterialRed;
- MaterialColor[ 7]=MaterialGreen;
- MaterialColor[ 8]=MaterialBlue;
- MaterialColor[ 9]=MaterialWhite;
- MaterialColor[10]=MaterialCyan;
- MaterialColor[11]=MaterialYellow;
- MaterialColor[12]=MaterialMagenta;
- MaterialColor[13]=MaterialRed;
- MaterialColor[14]=MaterialGreen;
- MaterialColor[15]=MaterialBlue;
- MaterialColor[16]=MaterialCyan;
- MaterialColor[17]=MaterialYellow;
- MaterialColor[18]=MaterialMagenta;
- MaterialColor[19]=MaterialGray;
- edgedivisions=icodivisions;
- Magnitude=2.5;
- break;
- }
- if (mono) {
- int loop;
- for (loop=0; loop<20; loop++) MaterialColor[loop]=MaterialGray;
- }
- if (smooth) {
- glShadeModel( GL_SMOOTH );
- } else {
- glShadeModel( GL_FLAT );
- }
-
-}
-
-static void init(void)
-{
- printf("Morph 3D - Shows morphing platonic polyhedra\n");
- printf("Author: Marcelo Fernandes Vianna ([email protected])\n\n");
- printf(" [1] - Tetrahedron\n");
- printf(" [2] - Hexahedron (Cube)\n");
- printf(" [3] - Octahedron\n");
- printf(" [4] - Dodecahedron\n");
- printf(" [5] - Icosahedron\n");
- printf("[SPACE] - Toggle colored faces\n");
- printf("[RETURN] - Toggle smooth/flat shading\n");
- printf(" [ESC] - Quit\n");
-
- object=1;
-
- glClearDepth(1.0);
- glClearColor( 0.0, 0.0, 0.0, 0.0 );
- glColor3f( 1.0, 1.0, 1.0 );
-
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
- glFlush();
- primary->Flip( primary, NULL, 0 );
-
- glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
- glLightfv(GL_LIGHT0, GL_POSITION, position0);
- glLightfv(GL_LIGHT1, GL_AMBIENT, ambient);
- glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse);
- glLightfv(GL_LIGHT1, GL_POSITION, position1);
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
- glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_LIGHT1);
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_NORMALIZE);
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_shininess);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_specular);
-
- glHint(GL_FOG_HINT, GL_FASTEST);
- glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
- glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
-
- pinit();
-}
-
-int main( int argc, char *argv[] )
-{
- int quit = 0;
- DFBResult err;
- DFBSurfaceDescription dsc;
-
- DFBCHECK(DirectFBInit( &argc, &argv ));
-
- /* create the super interface */
- DFBCHECK(DirectFBCreate( &dfb ));
-
- /* create an event buffer for all devices with these caps */
- DFBCHECK(dfb->CreateInputEventBuffer( dfb, DICAPS_KEYS, DFB_FALSE, &events ));
-
- /* set our cooperative level to DFSCL_FULLSCREEN
- for exclusive access to the primary layer */
- dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
-
- /* get the primary surface, i.e. the surface of the
- primary layer we have exclusive access to */
- dsc.flags = DSDESC_CAPS;
- dsc.caps = DSCAPS_PRIMARY | DSCAPS_DOUBLE;
-
- DFBCHECK(dfb->CreateSurface( dfb, &dsc, &primary ));
-
- /* get the size of the surface and fill it */
- DFBCHECK(primary->GetSize( primary, &screen_width, &screen_height ));
- DFBCHECK(primary->FillRectangle( primary, 0, 0,
- screen_width, screen_height ));
-
- /* create the default font and set it */
- DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font ));
- DFBCHECK(primary->SetFont( primary, font ));
-
- /* get the GL context */
- DFBCHECK(primary->GetGL( primary, &primary_gl ));
-
- DFBCHECK(primary_gl->Lock( primary_gl ));
-
- init();
- reshape(screen_width, screen_height);
-
- DFBCHECK(primary_gl->Unlock( primary_gl ));
-
- T0 = get_millis();
-
- while (!quit) {
- DFBInputEvent evt;
- unsigned long t;
-
- primary->Clear( primary, 0, 0, 0, 0 );
-
- DFBCHECK(primary_gl->Lock( primary_gl ));
-
- draw();
-
- DFBCHECK(primary_gl->Unlock( primary_gl ));
-
- if (fps) {
- char buf[64];
-
- sprintf(buf, "%4.1f FPS\n", fps);
- primary->SetColor( primary, 0xff, 0, 0, 0xff );
- primary->DrawString( primary, buf, -1, screen_width - 5, 5, DSTF_TOPRIGHT );
- }
-
- primary->Flip( primary, NULL, 0 );
- Frames++;
-
-
- t = get_millis();
- if (t - T0 >= 1000) {
- GLfloat seconds = (t - T0) / 1000.0;
-
- fps = Frames / seconds;
-
- T0 = t;
- Frames = 0;
- }
-
-
- while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) {
- switch (evt.type) {
- case DIET_KEYPRESS:
- switch (evt.key_symbol) {
- case DIKS_ESCAPE:
- quit = 1;
- break;
- case DIKS_1: object=1; break;
- case DIKS_2: object=2; break;
- case DIKS_3: object=3; break;
- case DIKS_4: object=4; break;
- case DIKS_5: object=5; break;
- case DIKS_SPACE: mono^=1; break;
- case DIKS_ENTER: smooth^=1; break;
- default:
- ;
- }
- pinit();
- break;
- default:
- ;
- }
- }
- }
-
- /* release our interfaces to shutdown DirectFB */
- primary_gl->Release( primary_gl );
- primary->Release( primary );
- font->Release( font );
- events->Release( events );
- dfb->Release( dfb );
-
- return 0;
-}
-
diff --git a/progs/directfb/df_reflect.c b/progs/directfb/df_reflect.c
deleted file mode 100644
index a0e789c3871..00000000000
--- a/progs/directfb/df_reflect.c
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- (c) Copyright 2001 convergence integrated media GmbH.
- All rights reserved.
-
- Written by Denis Oliver Kropp <[email protected]> and
- Andreas Hundt <[email protected]>.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include <directfb.h>
-#include <directfbgl.h>
-
-#include <GL/glu.h>
-
-#include "util/showbuffer.c"
-#include "util/readtex.c"
-
-
-/* the super interface */
-IDirectFB *dfb;
-
-/* the primary surface (surface of primary layer) */
-IDirectFBSurface *primary;
-
-/* the GL context */
-IDirectFBGL *primary_gl;
-
-/* our font */
-IDirectFBFont *font;
-
-/* event buffer */
-IDirectFBEventBuffer *events;
-
-/* macro for a safe call to DirectFB functions */
-#define DFBCHECK(x...) \
- { \
- err = x; \
- if (err != DFB_OK) { \
- fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
- DirectFBErrorFatal( #x, err ); \
- } \
- }
-
-static int screen_width, screen_height;
-
-static unsigned long T0 = 0;
-static GLint Frames = 0;
-static GLfloat fps = 0;
-
-static inline unsigned long get_millis()
-{
- struct timeval tv;
-
- gettimeofday (&tv, NULL);
- return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
-}
-
-/*******************************/
-
-#define DEG2RAD (3.14159/180.0)
-
-#define TABLE_TEXTURE "../images/tile.rgb"
-
-static GLint ImgWidth, ImgHeight;
-static GLenum ImgFormat;
-static GLubyte *Image = NULL;
-
-#define MAX_OBJECTS 2
-static GLint table_list;
-static GLint objects_list[MAX_OBJECTS];
-
-static GLfloat xrot, yrot;
-static GLfloat spin;
-
-static GLint Width = 400, Height = 300;
-static GLenum ShowBuffer = GL_NONE;
-
-
-static void make_table( void )
-{
- static GLfloat table_mat[] = { 1.0, 1.0, 1.0, 0.6 };
- static GLfloat gray[] = { 0.4, 0.4, 0.4, 1.0 };
-
- table_list = glGenLists(1);
- glNewList( table_list, GL_COMPILE );
-
- /* load table's texture */
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, table_mat );
-/* glMaterialfv( GL_FRONT, GL_EMISSION, gray );*/
- glMaterialfv( GL_FRONT, GL_DIFFUSE, table_mat );
- glMaterialfv( GL_FRONT, GL_AMBIENT, gray );
-
- /* draw textured square for the table */
- glPushMatrix();
- glScalef( 4.0, 4.0, 4.0 );
- glBegin( GL_POLYGON );
- glNormal3f( 0.0, 1.0, 0.0 );
- glTexCoord2f( 0.0, 0.0 ); glVertex3f( -1.0, 0.0, 1.0 );
- glTexCoord2f( 1.0, 0.0 ); glVertex3f( 1.0, 0.0, 1.0 );
- glTexCoord2f( 1.0, 1.0 ); glVertex3f( 1.0, 0.0, -1.0 );
- glTexCoord2f( 0.0, 1.0 ); glVertex3f( -1.0, 0.0, -1.0 );
- glEnd();
- glPopMatrix();
-
- glDisable( GL_TEXTURE_2D );
-
- glEndList();
-}
-
-
-static void make_objects( void )
-{
- GLUquadricObj *q;
-
- static GLfloat cyan[] = { 0.0, 1.0, 1.0, 1.0 };
- static GLfloat green[] = { 0.2, 1.0, 0.2, 1.0 };
- static GLfloat black[] = { 0.0, 0.0, 0.0, 0.0 };
-
- q = gluNewQuadric();
- gluQuadricDrawStyle( q, GLU_FILL );
- gluQuadricNormals( q, GLU_SMOOTH );
-
- objects_list[0] = glGenLists(1);
- glNewList( objects_list[0], GL_COMPILE );
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, cyan );
- glMaterialfv( GL_FRONT, GL_EMISSION, black );
- gluCylinder( q, 0.5, 0.5, 1.0, 15, 1 );
- glEndList();
-
- objects_list[1] = glGenLists(1);
- glNewList( objects_list[1], GL_COMPILE );
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green );
- glMaterialfv( GL_FRONT, GL_EMISSION, black );
- gluCylinder( q, 1.5, 0.0, 2.5, 15, 1 );
- glEndList();
-}
-
-
-static void init( void )
-{
- make_table();
- make_objects();
-
- Image = LoadRGBImage( TABLE_TEXTURE, &ImgWidth, &ImgHeight, &ImgFormat );
- if (!Image) {
- printf("Couldn't read %s\n", TABLE_TEXTURE);
- exit(0);
- }
-
- gluBuild2DMipmaps(GL_TEXTURE_2D, 3, ImgWidth, ImgHeight,
- ImgFormat, GL_UNSIGNED_BYTE, Image);
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
-
- xrot = 30.0;
- yrot = 50.0;
- spin = 0.0;
-
- glShadeModel( GL_FLAT );
-
- glEnable( GL_LIGHT0 );
- glEnable( GL_LIGHTING );
-
- glClearColor( 0.5, 0.5, 0.9, 0.0 );
-
- glEnable( GL_NORMALIZE );
-}
-
-
-
-static void reshape(int w, int h)
-{
- GLfloat yAspect = 2.5;
- GLfloat xAspect = yAspect * (float) w / (float) h;
- Width = w;
- Height = h;
- glViewport(0, 0, w, h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum( -xAspect, xAspect, -yAspect, yAspect, 10.0, 30.0 );
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-}
-
-
-
-static void draw_objects( GLfloat eyex, GLfloat eyey, GLfloat eyez )
-{
- (void) eyex;
- (void) eyey;
- (void) eyez;
-#ifndef USE_ZBUFFER
- if (eyex<0.5) {
-#endif
- glPushMatrix();
- glTranslatef( 1.0, 1.5, 0.0 );
- glRotatef( spin, 1.0, 0.5, 0.0 );
- glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
- glCallList( objects_list[0] );
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*spin) ), 0.0 );
- glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
- glRotatef( spin, 1.0, 0.5, 0.0 );
- glScalef( 0.5, 0.5, 0.5 );
- glCallList( objects_list[1] );
- glPopMatrix();
-#ifndef USE_ZBUFFER
- }
- else {
- glPushMatrix();
- glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*spin) ), 0.0 );
- glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
- glRotatef( spin, 1.0, 0.5, 0.0 );
- glScalef( 0.5, 0.5, 0.5 );
- glCallList( objects_list[1] );
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef( 1.0, 1.5, 0.0 );
- glRotatef( spin, 1.0, 0.5, 0.0 );
- glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
- glCallList( objects_list[0] );
- glPopMatrix();
- }
-#endif
-}
-
-
-
-static void draw_table( void )
-{
- glCallList( table_list );
-}
-
-
-
-static void draw( void )
-{
- static GLfloat light_pos[] = { 0.0, 20.0, 0.0, 1.0 };
- GLfloat dist = 20.0;
- GLfloat eyex, eyey, eyez;
-
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
-
-
- eyex = dist * cos(yrot*DEG2RAD) * cos(xrot*DEG2RAD);
- eyez = dist * sin(yrot*DEG2RAD) * cos(xrot*DEG2RAD);
- eyey = dist * sin(xrot*DEG2RAD);
-
- /* view from top */
- glPushMatrix();
- gluLookAt( eyex, eyey, eyez, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 );
-
- glLightfv( GL_LIGHT0, GL_POSITION, light_pos );
-
- /* draw table into stencil planes */
- glDisable( GL_DEPTH_TEST );
- glEnable( GL_STENCIL_TEST );
- glStencilFunc( GL_ALWAYS, 1, 0xffffffff );
- glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE );
- glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
- draw_table();
- glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
-
- glEnable( GL_DEPTH_TEST );
-
- /* render view from below (reflected viewport) */
- /* only draw where stencil==1 */
- if (eyey>0.0) {
- glPushMatrix();
-
- glStencilFunc( GL_EQUAL, 1, 0xffffffff ); /* draw if ==1 */
- glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
- glScalef( 1.0, -1.0, 1.0 );
-
- /* Reposition light in reflected space. */
- glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
-
- draw_objects(eyex, eyey, eyez);
- glPopMatrix();
-
- /* Restore light's original unreflected position. */
- glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
- }
-
- glDisable( GL_STENCIL_TEST );
-
- glEnable( GL_BLEND );
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
-
- glEnable( GL_TEXTURE_2D );
- draw_table();
- glDisable( GL_TEXTURE_2D );
- glDisable( GL_BLEND );
-
- /* view from top */
- glPushMatrix();
-
- draw_objects(eyex, eyey, eyez);
-
- glPopMatrix();
-
- glPopMatrix();
-
- if (ShowBuffer == GL_DEPTH) {
- ShowDepthBuffer(Width, Height, 1.0, 0.0);
- }
- else if (ShowBuffer == GL_STENCIL) {
- ShowStencilBuffer(Width, Height, 255.0, 0.0);
- }
- else if (ShowBuffer == GL_ALPHA) {
- ShowAlphaBuffer(Width, Height);
- }
-}
-
-/*******************************/
-
-int main( int argc, char *argv[] )
-{
- int quit = 0;
- DFBResult err;
- DFBSurfaceDescription dsc;
-
- DFBCHECK(DirectFBInit( &argc, &argv ));
-
- /* create the super interface */
- DFBCHECK(DirectFBCreate( &dfb ));
-
- /* create an event buffer for all devices with these caps */
- DFBCHECK(dfb->CreateInputEventBuffer( dfb, DICAPS_ALL, DFB_FALSE, &events ));
-
- /* set our cooperative level to DFSCL_FULLSCREEN
- for exclusive access to the primary layer */
- dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
-
- /* get the primary surface, i.e. the surface of the
- primary layer we have exclusive access to */
- dsc.flags = DSDESC_CAPS;
- dsc.caps = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_DOUBLE);
-
- DFBCHECK(dfb->CreateSurface( dfb, &dsc, &primary ));
-
- /* get the size of the surface and fill it */
- DFBCHECK(primary->GetSize( primary, &screen_width, &screen_height ));
- DFBCHECK(primary->FillRectangle( primary, 0, 0,
- screen_width, screen_height ));
-
- /* create the default font and set it */
- DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font ));
- DFBCHECK(primary->SetFont( primary, font ));
-
- /* get the GL context */
- DFBCHECK(primary->GetGL( primary, &primary_gl ));
-
- DFBCHECK(primary_gl->Lock( primary_gl ));
-
- init();
- reshape(screen_width, screen_height);
-
- DFBCHECK(primary_gl->Unlock( primary_gl ));
-
- T0 = get_millis();
-
- while (!quit) {
- DFBInputEvent evt;
- unsigned long t;
-
- DFBCHECK(primary_gl->Lock( primary_gl ));
-
- draw();
-
- DFBCHECK(primary_gl->Unlock( primary_gl ));
-
- if (fps) {
- char buf[64];
-
- sprintf(buf, "%4.1f FPS\n", fps);
- primary->SetColor( primary, 0xff, 0, 0, 0xff );
- primary->DrawString( primary, buf, -1, screen_width - 5, 5, DSTF_TOPRIGHT );
- }
-
- primary->Flip( primary, NULL, (DFBSurfaceFlipFlags)0 );
- Frames++;
-
-
- t = get_millis();
- if (t - T0 >= 1000) {
- GLfloat seconds = (t - T0) / 1000.0;
-
- fps = Frames / seconds;
-
- T0 = t;
- Frames = 0;
- }
-
-
- while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) {
- switch (evt.type) {
- case DIET_KEYPRESS:
- switch (DFB_LOWER_CASE(evt.key_symbol)) {
- case DIKS_ESCAPE:
- quit = 1;
- break;
- case DIKS_CURSOR_UP:
- xrot += 3.0;
- if ( xrot > 85 )
- xrot = 85;
- break;
- case DIKS_CURSOR_DOWN:
- xrot -= 3.0;
- if ( xrot < 5 )
- xrot = 5;
- break;
- case DIKS_CURSOR_LEFT:
- yrot += 3.0;
- break;
- case DIKS_CURSOR_RIGHT:
- yrot -= 3.0;
- break;
- case DIKS_SMALL_D:
- ShowBuffer = GL_DEPTH;
- break;
- case DIKS_SMALL_S:
- ShowBuffer = GL_STENCIL;
- break;
- case DIKS_SMALL_A:
- ShowBuffer = GL_ALPHA;
- break;
- default:
- ShowBuffer = GL_NONE;
- }
- break;
- case DIET_AXISMOTION:
- if (evt.flags & DIEF_AXISREL) {
- switch (evt.axis) {
- case DIAI_X:
- yrot += evt.axisrel / 2.0;
- break;
- case DIAI_Y:
- xrot += evt.axisrel / 2.0;
- break;
- default:
- ;
- }
- }
- break;
- default:
- ;
- }
- }
-
- spin += 2.0;
- yrot += 3.0;
- }
-
- /* release our interfaces to shutdown DirectFB */
- primary_gl->Release( primary_gl );
- primary->Release( primary );
- font->Release( font );
- events->Release( events );
- dfb->Release( dfb );
-
- return 0;
-}
-
diff --git a/progs/directfb/multi_window.c b/progs/directfb/multi_window.c
deleted file mode 100644
index 9bb0e4be8ef..00000000000
--- a/progs/directfb/multi_window.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- (c) Copyright 2001 convergence integrated media GmbH.
- All rights reserved.
-
- Written by Denis Oliver Kropp <[email protected]> and
- Andreas Hundt <[email protected]>.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <directfb.h>
-#include <directfbgl.h>
-
-
-typedef struct {
- IDirectFBWindow *window;
- IDirectFBSurface *surface;
- IDirectFBGL *gl;
-
- int width;
- int height;
-
- unsigned long last_time;
- int frames;
- float fps;
-} Context;
-
-static const GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0};
-
-static IDirectFB *dfb;
-static IDirectFBDisplayLayer *layer;
-static IDirectFBFont *font;
-static IDirectFBEventBuffer *events = NULL;
-
-/* macro for a safe call to DirectFB functions */
-#define DFBCHECK(x...) \
- do { \
- ret = x; \
- if (ret != DFB_OK) { \
- fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
- DirectFBErrorFatal( #x, ret ); \
- } \
- } while (0)
-
-
-static inline unsigned long get_millis()
-{
- struct timeval tv;
-
- gettimeofday (&tv, NULL);
- return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
-}
-
-
-static void
-setup( Context *context )
-{
- GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0};
-
- context->surface->GetSize( context->surface,
- &context->width, &context->height );
-
- context->gl->Lock( context->gl );
-
- glLightfv(GL_LIGHT0, GL_POSITION, pos);
- glEnable(GL_CULL_FACE);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- glViewport(0, 0, context->width, context->height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(70.0, context->width / (float) context->height, 1.0, 80.0);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -40.0);
-
- context->gl->Unlock( context->gl );
-}
-
-static void
-update( Context *context )
-{
- unsigned long t;
- IDirectFBSurface *surface = context->surface;
- static __u8 r = 0, g = 0, b = 0;
-
-
- context->gl->Lock( context->gl );
-
- glClearColor( r++/255.0, g++/255.0, b++/255.0, 1.0 );
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- context->gl->Unlock( context->gl );
-
- if (context->fps) {
- char buf[16];
-
- snprintf(buf, sizeof(buf), "%.1f FPS\n", context->fps);
-
- surface->SetColor( surface, 0xff, 0x00, 0x00, 0xff );
- surface->DrawString( surface, buf, -1,
- context->width - 5, 5, DSTF_TOPRIGHT );
- }
-
- surface->Flip( surface, NULL, 0 );
-
- context->frames++;
-
- t = get_millis();
- if (t - context->last_time >= 2000) {
- float seconds = (t - context->last_time) / 1000.0f;
-
- context->fps = context->frames / seconds;
-
- context->last_time = t;
- context->frames = 0;
- }
-}
-
-int
-main( int argc, char *argv[] )
-{
- DFBResult ret;
- int i;
- int quit = 0;
- const int num = 2;
- Context contexts[num];
-
- DFBCHECK(DirectFBInit( &argc, &argv ));
-
- /* create the super interface */
- DFBCHECK(DirectFBCreate( &dfb ));
-
- DFBCHECK(dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer ));
-
- /* create the default font */
- DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font ));
-
- for (i=0; i<num; i++) {
- IDirectFBWindow *window;
- IDirectFBSurface *surface;
- IDirectFBGL *gl;
- DFBWindowDescription desc;
-
- desc.flags = DWDESC_POSX | DWDESC_POSY |
- DWDESC_WIDTH | DWDESC_HEIGHT;
- desc.posx = (i%3) * 200 + 10;
- desc.posy = (i/3) * 200 + 10;
- desc.width = 180;
- desc.height = 180;
-
- DFBCHECK(layer->CreateWindow( layer, &desc, &window ));
- DFBCHECK(window->GetSurface( window, &surface ));
- DFBCHECK(surface->GetGL( surface, &gl ));
-
- contexts[i].window = window;
- contexts[i].surface = surface;
- contexts[i].gl = gl;
-
- contexts[i].last_time = get_millis();
- contexts[i].frames = 0;
- contexts[i].fps = 0;
-
- setup( &contexts[i] );
-
- if (events)
- DFBCHECK(window->AttachEventBuffer( window, events ));
- else
- DFBCHECK(window->CreateEventBuffer( window, &events ));
-
- DFBCHECK(surface->SetFont( surface, font ));
-
- window->SetOpacity( window, 0xff );
- }
-
- while (!quit) {
- DFBWindowEvent evt;
-
- for (i=0; i<num; i++)
- update( &contexts[i] );
-
- while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) {
- switch (evt.type) {
- case DWET_KEYDOWN:
- switch (evt.key_symbol) {
- case DIKS_ESCAPE:
- quit = 1;
- break;
-
- default:
- break;
- }
- break;
-
- default:
- break;
- }
- }
- }
-
- events->Release( events );
-
- for (i=0; i<num; i++) {
- contexts[i].gl->Release( contexts[i].gl );
- contexts[i].surface->Release( contexts[i].surface );
- contexts[i].window->Release( contexts[i].window );
- }
-
- font->Release( font );
- layer->Release( layer );
- dfb->Release( dfb );
-
- return 0;
-}
-
diff --git a/progs/egl/Makefile b/progs/egl/Makefile
index 0ddb2cabb4f..c003cf3cc55 100644
--- a/progs/egl/Makefile
+++ b/progs/egl/Makefile
@@ -48,19 +48,19 @@ eglinfo: eglinfo.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
eglgears: eglgears.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB) -lm
eglscreen: eglscreen.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
peglgears: peglgears.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB) -lm
xeglgears: xeglgears.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11 -lm
xeglthreads: xeglthreads.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11 -lm
xegl_tri: xegl_tri.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11
diff --git a/progs/egl/eglinfo.c b/progs/egl/eglinfo.c
index 37bc22e9fd0..961fd9ccc76 100644
--- a/progs/egl/eglinfo.c
+++ b/progs/egl/eglinfo.c
@@ -156,7 +156,42 @@ PrintModes(EGLDisplay d)
#endif
}
+static void
+PrintExtensions(EGLDisplay d)
+{
+ const char *extensions, *p, *end, *next;
+ int column;
+
+ printf("EGL extensions string:\n");
+ extensions = eglQueryString(d, EGL_EXTENSIONS);
+
+ column = 0;
+ end = extensions + strlen(extensions);
+
+ for (p = extensions; p < end; p = next + 1) {
+ next = strchr(p, ' ');
+ if (next == NULL)
+ next = end;
+
+ if (column > 0 && column + next - p + 1 > 70) {
+ printf("\n");
+ column = 0;
+ }
+ if (column == 0)
+ printf(" ");
+ else
+ printf(" ");
+ column += next - p + 1;
+
+ printf("%.*s", (int) (next - p), p);
+
+ p = next + 1;
+ }
+
+ if (column > 0)
+ printf("\n");
+}
int
main(int argc, char *argv[])
@@ -175,8 +210,8 @@ main(int argc, char *argv[])
#ifdef EGL_VERSION_1_2
printf("EGL client APIs: %s\n", eglQueryString(d, EGL_CLIENT_APIS));
#endif
- printf("EGL extensions string:\n");
- printf(" %s\n", eglQueryString(d, EGL_EXTENSIONS));
+
+ PrintExtensions(d);
PrintConfigs(d);
diff --git a/progs/egl/xeglgears.c b/progs/egl/xeglgears.c
index efb63ef3c91..a6a977d9fff 100644
--- a/progs/egl/xeglgears.c
+++ b/progs/egl/xeglgears.c
@@ -32,6 +32,9 @@
*/
+#define GL_GLEXT_PROTOTYPES
+#define EGL_EGLEXT_PROTOTYPES
+
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
@@ -42,6 +45,8 @@
#include <GL/gl.h>
#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
#define BENCHMARK
@@ -335,9 +340,13 @@ struct egl_manager {
EGLSurface win;
EGLSurface pix;
EGLSurface pbuf;
+ EGLImageKHR image;
EGLBoolean verbose;
EGLint major, minor;
+
+ GC gc;
+ GLuint fbo;
};
static struct egl_manager *
@@ -469,6 +478,8 @@ egl_manager_create_window(struct egl_manager *eman, const char *name,
}
}
+ eman->gc = XCreateGC(eman->xdpy, eman->xwin, 0, NULL);
+
XMapWindow(eman->xdpy, eman->xwin);
return EGL_TRUE;
@@ -525,20 +536,28 @@ egl_manager_destroy(struct egl_manager *eman)
if (eman->xpix != None)
XFreePixmap(eman->xdpy, eman->xpix);
+ XFreeGC(eman->xdpy, eman->gc);
+
free(eman);
}
-enum { GEARS_WINDOW, GEARS_PIXMAP, GEARS_PBUFFER_COPY, GEARS_PBUFFER_TEXTURE };
+enum {
+ GEARS_WINDOW,
+ GEARS_PIXMAP,
+ GEARS_PIXMAP_TEXTURE,
+ GEARS_PBUFFER,
+ GEARS_PBUFFER_TEXTURE,
+ GEARS_RENDERBUFFER
+};
static void
-texture_gears(struct egl_manager *eman)
+texture_gears(struct egl_manager *eman, int surface_type)
{
static const GLint verts[12] =
{ -5, -6, -10, 5, -6, -10, -5, 4, 10, 5, 4, 10 };
static const GLint tex_coords[8] = { 0, 0, 1, 0, 0, 1, 1, 1 };
- static const GLuint indices[4] = { 0, 1, 2, 3 };
- eglMakeCurrent(eman->dpy, eman->pix, eman->pix, eman->ctx);
+ eglMakeCurrent(eman->dpy, eman->win, eman->win, eman->ctx);
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -554,22 +573,42 @@ texture_gears(struct egl_manager *eman)
glVertexPointer(3, GL_INT, 0, verts);
glTexCoordPointer(2, GL_INT, 0, tex_coords);
- eglBindTexImage(eman->dpy, eman->pbuf, EGL_BACK_BUFFER);
+ if (surface_type == GEARS_PBUFFER_TEXTURE)
+ eglBindTexImage(eman->dpy, eman->pbuf, EGL_BACK_BUFFER);
- glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, indices);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisable(GL_TEXTURE_2D);
- eglReleaseTexImage(eman->dpy, eman->pbuf, EGL_BACK_BUFFER);
+ if (surface_type == GEARS_PBUFFER_TEXTURE)
+ eglReleaseTexImage(eman->dpy, eman->pbuf, EGL_BACK_BUFFER);
+
+ eglSwapBuffers(eman->dpy, eman->win);
+}
+
+static void
+copy_gears(struct egl_manager *eman,
+ EGLint tile_w, EGLint tile_h, EGLint w, EGLint h)
+{
+ int x, y;
+
+ eglWaitClient();
+
+ for (x = 0; x < w; x += tile_w) {
+ for (y = 0; y < h; y += tile_h) {
+
+ XCopyArea(eman->xdpy, eman->xpix, eman->xwin, eman->gc,
+ 0, 0, tile_w, tile_h, x, y);
+ }
+ }
}
static void
event_loop(struct egl_manager *eman, EGLint surface_type, EGLint w, EGLint h)
{
- GC gc = XCreateGC(eman->xdpy, eman->xwin, 0, NULL);
- EGLint orig_w = w, orig_h = h;
+ int window_w = w, window_h = h;
if (surface_type == EGL_PBUFFER_BIT)
printf("there will be no screen update if "
@@ -584,10 +623,10 @@ event_loop(struct egl_manager *eman, EGLint surface_type, EGLint w, EGLint h)
/* we'll redraw below */
break;
case ConfigureNotify:
- w = event.xconfigure.width;
- h = event.xconfigure.height;
+ window_w = event.xconfigure.width;
+ window_h = event.xconfigure.height;
if (surface_type == EGL_WINDOW_BIT)
- reshape(w, h);
+ reshape(window_w, window_h);
break;
case KeyPress:
{
@@ -622,7 +661,6 @@ event_loop(struct egl_manager *eman, EGLint surface_type, EGLint w, EGLint h)
static int frames = 0;
static double tRot0 = -1.0, tRate0 = -1.0;
double dt, t = current_time();
- int x, y;
if (tRot0 < 0.0)
tRot0 = t;
dt = t - tRot0;
@@ -633,34 +671,43 @@ event_loop(struct egl_manager *eman, EGLint surface_type, EGLint w, EGLint h)
if (angle > 3600.0)
angle -= 3600.0;
- if (surface_type == GEARS_PBUFFER_TEXTURE)
- eglMakeCurrent(eman->dpy, eman->pbuf, eman->pbuf, eman->ctx);
-
- draw();
switch (surface_type) {
case GEARS_WINDOW:
+ draw();
eglSwapBuffers(eman->dpy, eman->win);
break;
- case GEARS_PBUFFER_TEXTURE:
- case GEARS_PBUFFER_COPY:
- if (surface_type == GEARS_PBUFFER_TEXTURE) {
- texture_gears(eman);
- } else {
- if (!eglCopyBuffers(eman->dpy, eman->pbuf, eman->xpix))
- break;
- }
- eglWaitClient();
- /* fall through */
- case GEARS_PIXMAP:
- eglWaitClient();
- for (x = 0; x < w; x += orig_w) {
- for (y = 0; y < h; y += orig_h) {
- XCopyArea(eman->xdpy, eman->xpix, eman->xwin, gc,
- 0, 0, orig_w, orig_h, x, y);
- }
- }
- break;
- }
+
+ case GEARS_PBUFFER:
+ draw();
+ if (!eglCopyBuffers(eman->dpy, eman->pbuf, eman->xpix))
+ break;
+ copy_gears(eman, w, h, window_w, window_h);
+ break;
+
+ case GEARS_PBUFFER_TEXTURE:
+ eglMakeCurrent(eman->dpy, eman->pbuf, eman->pbuf, eman->ctx);
+ draw();
+ texture_gears(eman, surface_type);
+ break;
+
+ case GEARS_PIXMAP:
+ draw();
+ copy_gears(eman, w, h, window_w, window_h);
+ break;
+
+ case GEARS_PIXMAP_TEXTURE:
+ eglMakeCurrent(eman->dpy, eman->pix, eman->pix, eman->ctx);
+ draw();
+ texture_gears(eman, surface_type);
+ break;
+
+ case GEARS_RENDERBUFFER:
+ glBindFramebuffer(GL_FRAMEBUFFER_EXT, eman->fbo);
+ draw();
+ glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
+ texture_gears(eman, surface_type);
+ break;
+ }
frames++;
@@ -676,8 +723,6 @@ event_loop(struct egl_manager *eman, EGLint surface_type, EGLint w, EGLint h)
}
}
}
-
- XFreeGC(eman->xdpy, gc);
}
@@ -689,10 +734,20 @@ usage(void)
printf(" -fullscreen run in fullscreen mode\n");
printf(" -info display OpenGL renderer info\n");
printf(" -pixmap use pixmap surface\n");
- printf(" -pbuffer-copy use pbuffer surface and eglCopyBuffers\n");
+ printf(" -pixmap-texture use pixmap surface and texture using EGLImage\n");
+ printf(" -pbuffer use pbuffer surface and eglCopyBuffers\n");
printf(" -pbuffer-texture use pbuffer surface and eglBindTexImage\n");
+ printf(" -renderbuffer renderbuffer as EGLImage and bind as texture from\n");
}
+static const char *names[] = {
+ "window",
+ "pixmap",
+ "pixmap_texture",
+ "pbuffer",
+ "pbuffer_texture",
+ "renderbuffer"
+};
int
main(int argc, char *argv[])
@@ -715,6 +770,7 @@ main(int argc, char *argv[])
GLboolean printInfo = GL_FALSE;
GLboolean fullscreen = GL_FALSE;
EGLBoolean ret;
+ GLuint texture, color_rb, depth_rb;
int i;
for (i = 1; i < argc; i++) {
@@ -732,14 +788,21 @@ main(int argc, char *argv[])
surface_type = GEARS_PIXMAP;
attribs[1] = EGL_PIXMAP_BIT;
}
- else if (strcmp(argv[i], "-pbuffer-copy") == 0) {
- surface_type = GEARS_PBUFFER_COPY;
+ else if (strcmp(argv[i], "-pixmap-texture") == 0) {
+ surface_type = GEARS_PIXMAP_TEXTURE;
+ attribs[1] = EGL_PIXMAP_BIT;
+ }
+ else if (strcmp(argv[i], "-pbuffer") == 0) {
+ surface_type = GEARS_PBUFFER;
attribs[1] = EGL_PBUFFER_BIT;
}
else if (strcmp(argv[i], "-pbuffer-texture") == 0) {
surface_type = GEARS_PBUFFER_TEXTURE;
attribs[1] = EGL_PBUFFER_BIT;
}
+ else if (strcmp(argv[i], "-renderbuffer") == 0) {
+ surface_type = GEARS_RENDERBUFFER;
+ }
else {
usage();
return -1;
@@ -761,28 +824,32 @@ main(int argc, char *argv[])
return -1;
}
- snprintf(win_title, sizeof(win_title), "xeglgears (%s)",
- (surface_type == GEARS_WINDOW) ? "window" :
- (surface_type == GEARS_PIXMAP) ? "pixmap" : "pbuffer");
+ snprintf(win_title, sizeof(win_title),
+ "xeglgears (%s)", names[surface_type]);
+
+ ret = egl_manager_create_window(eman, win_title, winWidth, winHeight,
+ EGL_TRUE, fullscreen, NULL);
+ if (!ret)
+ return -1;
/* create surface(s) */
switch (surface_type) {
case GEARS_WINDOW:
- ret = egl_manager_create_window(eman, win_title, winWidth, winHeight,
- EGL_TRUE, fullscreen, NULL);
if (ret)
ret = eglMakeCurrent(eman->dpy, eman->win, eman->win, eman->ctx);
break;
case GEARS_PIXMAP:
- ret = (egl_manager_create_window(eman, win_title, winWidth, winHeight,
- EGL_FALSE, fullscreen, NULL) &&
- egl_manager_create_pixmap(eman, eman->xwin,
- EGL_TRUE, NULL));
+ case GEARS_PIXMAP_TEXTURE:
+ ret = egl_manager_create_pixmap(eman, eman->xwin, EGL_TRUE, NULL);
+ if (surface_type == GEARS_PIXMAP_TEXTURE)
+ eman->image = eglCreateImageKHR (eman->dpy, eman->ctx,
+ EGL_NATIVE_PIXMAP_KHR,
+ (EGLClientBuffer) eman->xpix, NULL);
if (ret)
ret = eglMakeCurrent(eman->dpy, eman->pix, eman->pix, eman->ctx);
break;
+ case GEARS_PBUFFER:
case GEARS_PBUFFER_TEXTURE:
- case GEARS_PBUFFER_COPY:
{
EGLint pbuf_attribs[] = {
EGL_WIDTH, winWidth,
@@ -791,20 +858,69 @@ main(int argc, char *argv[])
EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
EGL_NONE
};
- ret = (egl_manager_create_window(eman, win_title, winWidth, winHeight,
- EGL_FALSE, fullscreen, NULL) &&
- egl_manager_create_pixmap(eman, eman->xwin,
+ ret = (egl_manager_create_pixmap(eman, eman->xwin,
EGL_TRUE, NULL) &&
egl_manager_create_pbuffer(eman, pbuf_attribs));
if (ret)
ret = eglMakeCurrent(eman->dpy, eman->pbuf, eman->pbuf, eman->ctx);
}
break;
+
+
+ case GEARS_RENDERBUFFER:
+ ret = eglMakeCurrent(eman->dpy, eman->win, eman->win, eman->ctx);
+ if (ret == EGL_FALSE)
+ printf("failed to make context current\n");
+
+ glGenFramebuffers(1, &eman->fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER_EXT, eman->fbo);
+
+ glGenRenderbuffers(1, &color_rb);
+ glBindRenderbuffer(GL_RENDERBUFFER_EXT, color_rb);
+ glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_RGBA, winWidth, winHeight);
+ glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
+ GL_COLOR_ATTACHMENT0_EXT,
+ GL_RENDERBUFFER_EXT,
+ color_rb);
+
+ eman->image = eglCreateImageKHR(eman->dpy, eman->ctx,
+ EGL_GL_RENDERBUFFER_KHR,
+ (EGLClientBuffer) color_rb, NULL);
+
+ glGenRenderbuffers(1, &depth_rb);
+ glBindRenderbuffer(GL_RENDERBUFFER_EXT, depth_rb);
+ glRenderbufferStorage(GL_RENDERBUFFER_EXT,
+ GL_DEPTH_COMPONENT, winWidth, winHeight);
+ glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
+ GL_DEPTH_ATTACHMENT_EXT,
+ GL_RENDERBUFFER_EXT,
+ depth_rb);
+
+ if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE) {
+ printf("framebuffer not complete\n");
+ exit(1);
+ }
+
+ break;
+
default:
ret = EGL_FALSE;
break;
}
+ switch (surface_type) {
+ case GEARS_PIXMAP_TEXTURE:
+ case GEARS_RENDERBUFFER:
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, eman->image);
+ break;
+ case GEARS_PBUFFER_TEXTURE:
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ break;
+ }
+
if (!ret) {
egl_manager_destroy(eman);
XCloseDisplay(x_dpy);
diff --git a/progs/fp/Makefile b/progs/fp/Makefile
index 681928cf260..ed959dae302 100755
--- a/progs/fp/Makefile
+++ b/progs/fp/Makefile
@@ -56,14 +56,6 @@ default: $(UTIL_FILES) $(PROGS)
clean:
-rm -f $(PROGS)
-rm -f *.o
- -rm -f getproclist.h
-
-
-# auto code generation
-getprocaddress: getprocaddress.c getproclist.h
-
-getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py
- python getprocaddress.py > getproclist.h
texrect: texrect.o readtex.o
diff --git a/progs/gallium/python/retrace/interpreter.py b/progs/gallium/python/retrace/interpreter.py
index 2db71a212f6..1a961812553 100755
--- a/progs/gallium/python/retrace/interpreter.py
+++ b/progs/gallium/python/retrace/interpreter.py
@@ -543,7 +543,7 @@ class Context(Object):
gallium.PIPE_FORMAT_R32G32_FLOAT: '2f',
gallium.PIPE_FORMAT_R32G32B32_FLOAT: '3f',
gallium.PIPE_FORMAT_R32G32B32A32_FLOAT: '4f',
- gallium.PIPE_FORMAT_B8G8R8A8_UNORM: '4B',
+ gallium.PIPE_FORMAT_A8R8G8B8_UNORM: '4B',
gallium.PIPE_FORMAT_R8G8B8A8_UNORM: '4B',
gallium.PIPE_FORMAT_R16G16B16_SNORM: '3h',
}[velem.src_format]
@@ -551,7 +551,6 @@ class Context(Object):
data = vbuf.buffer.read()
values = unpack_from(format, data, offset)
sys.stdout.write('\t\t{' + ', '.join(map(str, values)) + '},\n')
- assert len(values) == velem.nr_components
sys.stdout.write('\t},\n')
sys.stdout.flush()
@@ -572,7 +571,7 @@ class Context(Object):
sys.stdout.write('\t{\n')
for i in range(start, start + count):
- if i >= start + 16:
+ if i >= start + 16 and not self.interpreter.verbosity(3):
sys.stdout.write('\t...\n')
break
offset = i*isize
diff --git a/progs/gallium/python/samples/gs.py b/progs/gallium/python/samples/gs.py
index cd68abac9a1..5c22269b183 100644
--- a/progs/gallium/python/samples/gs.py
+++ b/progs/gallium/python/samples/gs.py
@@ -134,7 +134,7 @@ def test(dev):
# framebuffer
cbuf = dev.texture_create(
- PIPE_FORMAT_X8R8G8B8_UNORM,
+ PIPE_FORMAT_B8G8R8X8_UNORM,
width, height,
tex_usage=PIPE_TEXTURE_USAGE_RENDER_TARGET,
).get_surface()
diff --git a/progs/gallium/python/samples/tri.py b/progs/gallium/python/samples/tri.py
index f0b5e3dc984..d7fbdb10ac3 100644
--- a/progs/gallium/python/samples/tri.py
+++ b/progs/gallium/python/samples/tri.py
@@ -134,7 +134,7 @@ def test(dev):
# framebuffer
cbuf = dev.texture_create(
- PIPE_FORMAT_X8R8G8B8_UNORM,
+ PIPE_FORMAT_B8G8R8X8_UNORM,
width, height,
tex_usage=PIPE_TEXTURE_USAGE_RENDER_TARGET,
).get_surface()
diff --git a/progs/gallium/python/tests/base.py b/progs/gallium/python/tests/base.py
index b022d073fda..bd82f50811f 100755
--- a/progs/gallium/python/tests/base.py
+++ b/progs/gallium/python/tests/base.py
@@ -50,8 +50,8 @@ def is_depth_stencil_format(format):
# FIXME: make and use binding to util_format_is_depth_or_stencil
return format in (
PIPE_FORMAT_Z32_UNORM,
- PIPE_FORMAT_Z24S8_UNORM,
- PIPE_FORMAT_Z24X8_UNORM,
+ PIPE_FORMAT_S8Z24_UNORM,
+ PIPE_FORMAT_X8Z24_UNORM,
PIPE_FORMAT_Z16_UNORM,
)
diff --git a/progs/gallium/python/tests/regress/fragment-shader/fragment-shader.py b/progs/gallium/python/tests/regress/fragment-shader/fragment-shader.py
index 41dd69d2542..b758b4c6221 100644
--- a/progs/gallium/python/tests/regress/fragment-shader/fragment-shader.py
+++ b/progs/gallium/python/tests/regress/fragment-shader/fragment-shader.py
@@ -113,7 +113,7 @@ def test(dev, name):
# framebuffer
cbuf = dev.texture_create(
- PIPE_FORMAT_X8R8G8B8_UNORM,
+ PIPE_FORMAT_B8G8R8X8_UNORM,
width, height,
tex_usage=PIPE_TEXTURE_USAGE_RENDER_TARGET,
).get_surface()
diff --git a/progs/gallium/python/tests/regress/vertex-shader/vertex-shader.py b/progs/gallium/python/tests/regress/vertex-shader/vertex-shader.py
index 2c44f872e1d..bd838cc282b 100644
--- a/progs/gallium/python/tests/regress/vertex-shader/vertex-shader.py
+++ b/progs/gallium/python/tests/regress/vertex-shader/vertex-shader.py
@@ -114,7 +114,7 @@ def test(dev, name):
# framebuffer
cbuf = dev.texture_create(
- PIPE_FORMAT_X8R8G8B8_UNORM,
+ PIPE_FORMAT_B8G8R8X8_UNORM,
width, height,
tex_usage=PIPE_TEXTURE_USAGE_RENDER_TARGET,
).get_surface()
diff --git a/progs/gallium/python/tests/surface_copy.py b/progs/gallium/python/tests/surface_copy.py
index df5babb78af..a3f1b3e130c 100755
--- a/progs/gallium/python/tests/surface_copy.py
+++ b/progs/gallium/python/tests/surface_copy.py
@@ -131,15 +131,15 @@ def main():
]
formats = [
- PIPE_FORMAT_A8R8G8B8_UNORM,
- PIPE_FORMAT_X8R8G8B8_UNORM,
- PIPE_FORMAT_A8R8G8B8_SRGB,
- PIPE_FORMAT_R5G6B5_UNORM,
- PIPE_FORMAT_A1R5G5B5_UNORM,
- PIPE_FORMAT_A4R4G4B4_UNORM,
+ PIPE_FORMAT_B8G8R8A8_UNORM,
+ PIPE_FORMAT_B8G8R8X8_UNORM,
+ PIPE_FORMAT_B8G8R8A8_SRGB,
+ PIPE_FORMAT_B5G6R5_UNORM,
+ PIPE_FORMAT_B5G5R5A1_UNORM,
+ PIPE_FORMAT_B4G4R4A4_UNORM,
PIPE_FORMAT_Z32_UNORM,
- PIPE_FORMAT_Z24S8_UNORM,
- PIPE_FORMAT_Z24X8_UNORM,
+ PIPE_FORMAT_S8Z24_UNORM,
+ PIPE_FORMAT_X8Z24_UNORM,
PIPE_FORMAT_Z16_UNORM,
PIPE_FORMAT_S8_UNORM,
PIPE_FORMAT_A8_UNORM,
diff --git a/progs/gallium/python/tests/texture_render.py b/progs/gallium/python/tests/texture_render.py
index 0fac1ea5ef3..1e26639db68 100755
--- a/progs/gallium/python/tests/texture_render.py
+++ b/progs/gallium/python/tests/texture_render.py
@@ -96,7 +96,7 @@ class TextureTest(TestCase):
src_texture = dev.texture_create(
target = target,
- format = PIPE_FORMAT_A8R8G8B8_UNORM,
+ format = PIPE_FORMAT_B8G8R8A8_UNORM,
width = dst_surface.width,
height = dst_surface.height,
depth = 1,
@@ -149,7 +149,7 @@ class TextureTest(TestCase):
# framebuffer
cbuf_tex = dev.texture_create(
- PIPE_FORMAT_A8R8G8B8_UNORM,
+ PIPE_FORMAT_B8G8R8A8_UNORM,
width,
height,
tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
@@ -251,15 +251,15 @@ def main():
]
formats = [
- PIPE_FORMAT_A8R8G8B8_UNORM,
- PIPE_FORMAT_X8R8G8B8_UNORM,
- #PIPE_FORMAT_A8R8G8B8_SRGB,
- PIPE_FORMAT_R5G6B5_UNORM,
- PIPE_FORMAT_A1R5G5B5_UNORM,
- PIPE_FORMAT_A4R4G4B4_UNORM,
+ PIPE_FORMAT_B8G8R8A8_UNORM,
+ PIPE_FORMAT_B8G8R8X8_UNORM,
+ #PIPE_FORMAT_B8G8R8A8_SRGB,
+ PIPE_FORMAT_B5G6R5_UNORM,
+ PIPE_FORMAT_B5G5R5A1_UNORM,
+ PIPE_FORMAT_B4G4R4A4_UNORM,
#PIPE_FORMAT_Z32_UNORM,
- #PIPE_FORMAT_Z24S8_UNORM,
- #PIPE_FORMAT_Z24X8_UNORM,
+ #PIPE_FORMAT_S8Z24_UNORM,
+ #PIPE_FORMAT_X8Z24_UNORM,
#PIPE_FORMAT_Z16_UNORM,
#PIPE_FORMAT_S8_UNORM,
PIPE_FORMAT_A8_UNORM,
diff --git a/progs/gallium/python/tests/texture_sample.py b/progs/gallium/python/tests/texture_sample.py
index db32b537a17..49545c2e07a 100755
--- a/progs/gallium/python/tests/texture_sample.py
+++ b/progs/gallium/python/tests/texture_sample.py
@@ -193,7 +193,7 @@ class TextureColorSampleTest(TestCase):
# framebuffer
cbuf_tex = dev.texture_create(
- PIPE_FORMAT_A8R8G8B8_UNORM,
+ PIPE_FORMAT_B8G8R8A8_UNORM,
width,
height,
tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
@@ -383,14 +383,14 @@ class TextureDepthSampleTest(TestCase):
# framebuffer
cbuf_tex = dev.texture_create(
- PIPE_FORMAT_A8R8G8B8_UNORM,
+ PIPE_FORMAT_B8G8R8A8_UNORM,
width,
height,
tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
)
zsbuf_tex = dev.texture_create(
- PIPE_FORMAT_Z24X8_UNORM,
+ PIPE_FORMAT_X8Z24_UNORM,
width,
height,
tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
@@ -498,15 +498,15 @@ def main():
]
color_formats = [
- PIPE_FORMAT_A8R8G8B8_UNORM,
- PIPE_FORMAT_X8R8G8B8_UNORM,
- #PIPE_FORMAT_A8R8G8B8_SRGB,
- PIPE_FORMAT_R5G6B5_UNORM,
- PIPE_FORMAT_A1R5G5B5_UNORM,
- PIPE_FORMAT_A4R4G4B4_UNORM,
+ PIPE_FORMAT_B8G8R8A8_UNORM,
+ PIPE_FORMAT_B8G8R8X8_UNORM,
+ #PIPE_FORMAT_B8G8R8A8_SRGB,
+ PIPE_FORMAT_B5G6R5_UNORM,
+ PIPE_FORMAT_B5G5R5A1_UNORM,
+ PIPE_FORMAT_B4G4R4A4_UNORM,
PIPE_FORMAT_A8_UNORM,
PIPE_FORMAT_L8_UNORM,
- PIPE_FORMAT_YCBCR,
+ PIPE_FORMAT_UYVY,
PIPE_FORMAT_DXT1_RGB,
#PIPE_FORMAT_DXT1_RGBA,
#PIPE_FORMAT_DXT3_RGBA,
@@ -515,8 +515,8 @@ def main():
depth_formats = [
PIPE_FORMAT_Z32_UNORM,
- PIPE_FORMAT_Z24S8_UNORM,
- PIPE_FORMAT_Z24X8_UNORM,
+ PIPE_FORMAT_S8Z24_UNORM,
+ PIPE_FORMAT_X8Z24_UNORM,
PIPE_FORMAT_Z16_UNORM,
]
diff --git a/progs/gallium/python/tests/texture_transfer.py b/progs/gallium/python/tests/texture_transfer.py
index 35daca9e498..7da00e42550 100755
--- a/progs/gallium/python/tests/texture_transfer.py
+++ b/progs/gallium/python/tests/texture_transfer.py
@@ -111,15 +111,15 @@ def main():
]
formats = [
- PIPE_FORMAT_A8R8G8B8_UNORM,
- PIPE_FORMAT_X8R8G8B8_UNORM,
- PIPE_FORMAT_A8R8G8B8_SRGB,
- PIPE_FORMAT_R5G6B5_UNORM,
- PIPE_FORMAT_A1R5G5B5_UNORM,
- PIPE_FORMAT_A4R4G4B4_UNORM,
+ PIPE_FORMAT_B8G8R8A8_UNORM,
+ PIPE_FORMAT_B8G8R8X8_UNORM,
+ PIPE_FORMAT_B8G8R8A8_SRGB,
+ PIPE_FORMAT_B5G6R5_UNORM,
+ PIPE_FORMAT_B5G5R5A1_UNORM,
+ PIPE_FORMAT_B4G4R4A4_UNORM,
PIPE_FORMAT_Z32_UNORM,
- PIPE_FORMAT_Z24S8_UNORM,
- PIPE_FORMAT_Z24X8_UNORM,
+ PIPE_FORMAT_S8Z24_UNORM,
+ PIPE_FORMAT_X8Z24_UNORM,
PIPE_FORMAT_Z16_UNORM,
PIPE_FORMAT_S8_UNORM,
PIPE_FORMAT_A8_UNORM,
diff --git a/progs/gallium/unit/SConscript b/progs/gallium/unit/SConscript
new file mode 100644
index 00000000000..9891440df6a
--- /dev/null
+++ b/progs/gallium/unit/SConscript
@@ -0,0 +1,20 @@
+Import('*')
+
+env = env.Clone()
+
+env.Prepend(LIBS = [gallium])
+
+progs = [
+ 'u_format_test'
+]
+
+for prog in progs:
+ prog = env.Program(
+ target = prog,
+ source = prog + '.c',
+ )
+
+ # http://www.scons.org/wiki/UnitTests
+ test_alias = env.Alias('unit', [prog], prog[0].abspath)
+ AlwaysBuild(test_alias)
+
diff --git a/progs/gallium/unit/u_format_test.c b/progs/gallium/unit/u_format_test.c
new file mode 100644
index 00000000000..5274311e035
--- /dev/null
+++ b/progs/gallium/unit/u_format_test.c
@@ -0,0 +1,242 @@
+/**************************************************************************
+ *
+ * Copyright 2009-2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "util/u_format.h"
+#include "util/u_format_tests.h"
+#include "util/u_format_pack.h"
+
+
+static boolean
+test_format_unpack_4f(const struct util_format_test_case *test)
+{
+ float unpacked[4];
+ unsigned i;
+ boolean success;
+
+ util_format_unpack_4f(test->format, unpacked, test->packed);
+
+ success = TRUE;
+ for (i = 0; i < 4; ++i)
+ if (test->unpacked[i] != unpacked[i])
+ success = FALSE;
+
+ if (!success) {
+ printf("FAILED: (%f %f %f %f) obtained\n", unpacked[0], unpacked[1], unpacked[2], unpacked[3]);
+ printf(" (%f %f %f %f) expected\n", test->unpacked[0], test->unpacked[1], test->unpacked[2], test->unpacked[3]);
+ }
+
+ return success;
+}
+
+
+static boolean
+test_format_pack_4f(const struct util_format_test_case *test)
+{
+ uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
+ unsigned i;
+ boolean success;
+
+ memset(packed, 0, sizeof packed);
+
+ util_format_pack_4f(test->format, packed, test->unpacked[0], test->unpacked[1], test->unpacked[2], test->unpacked[3]);
+
+ success = TRUE;
+ for (i = 0; i < UTIL_FORMAT_MAX_PACKED_BYTES; ++i)
+ if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
+ success = FALSE;
+
+ if (!success) {
+ /* TODO: print more than 4 bytes */
+ printf("FAILED: (%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x) obtained\n",
+ packed[0], packed[1], packed[2], packed[3],
+ packed[4], packed[5], packed[6], packed[7],
+ packed[8], packed[9], packed[10], packed[11],
+ packed[12], packed[13], packed[14], packed[15]);
+ printf(" (%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x) expected\n",
+ test->packed[0], test->packed[1], test->packed[2], test->packed[3],
+ test->packed[4], test->packed[5], test->packed[6], test->packed[7],
+ test->packed[8], test->packed[9], test->packed[10], test->packed[11],
+ test->packed[12], test->packed[13], test->packed[14], test->packed[15]);
+ }
+
+ return success;
+}
+
+
+static boolean
+convert_4f_to_4ub(uint8_t *dst, const double *src)
+{
+ unsigned i;
+ boolean accurate = TRUE;
+
+ for (i = 0; i < 4; ++i) {
+ if (src[i] < 0.0) {
+ accurate = FALSE;
+ dst[i] = 0;
+ }
+ else if (src[i] > 1.0) {
+ accurate = FALSE;
+ dst[i] = 255;
+ }
+ else {
+ dst[i] = src[i] * 255.0;
+ }
+ }
+
+ return accurate;
+}
+
+
+static boolean
+test_format_unpack_4ub(const struct util_format_test_case *test)
+{
+ uint8_t unpacked[4];
+ uint8_t expected[4];
+ unsigned i;
+ boolean success;
+
+ util_format_unpack_4ub(test->format, unpacked, test->packed);
+
+ convert_4f_to_4ub(expected, test->unpacked);
+
+ success = TRUE;
+ for (i = 0; i < 4; ++i)
+ if (expected[i] != unpacked[i])
+ success = FALSE;
+
+ if (!success) {
+ printf("FAILED: (0x%02x 0x%02x 0x%02x 0x%02x) obtained\n", unpacked[0], unpacked[1], unpacked[2], unpacked[3]);
+ printf(" (0x%02x 0x%02x 0x%02x 0x%02x) expected\n", expected[0], expected[1], expected[2], expected[3]);
+ }
+
+ return success;
+}
+
+
+static boolean
+test_format_pack_4ub(const struct util_format_test_case *test)
+{
+ uint8_t unpacked[4];
+ uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
+ unsigned i;
+ boolean success;
+
+ if (!convert_4f_to_4ub(unpacked, test->unpacked)) {
+ /*
+ * Skip test cases which cannot be represented by four unorm bytes.
+ */
+ return TRUE;
+ }
+
+ memset(packed, 0, sizeof packed);
+
+ util_format_pack_4ub(test->format, packed, unpacked[0], unpacked[1], unpacked[2], unpacked[3]);
+
+ success = TRUE;
+ for (i = 0; i < UTIL_FORMAT_MAX_PACKED_BYTES; ++i)
+ if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
+ success = FALSE;
+
+ if (!success) {
+ /* TODO: print more than 4 bytes */
+ printf("FAILED: (%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x) obtained\n",
+ packed[0], packed[1], packed[2], packed[3],
+ packed[4], packed[5], packed[6], packed[7],
+ packed[8], packed[9], packed[10], packed[11],
+ packed[12], packed[13], packed[14], packed[15]);
+ printf(" (%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x) expected\n",
+ test->packed[0], test->packed[1], test->packed[2], test->packed[3],
+ test->packed[4], test->packed[5], test->packed[6], test->packed[7],
+ test->packed[8], test->packed[9], test->packed[10], test->packed[11],
+ test->packed[12], test->packed[13], test->packed[14], test->packed[15]);
+ }
+
+ return success;
+}
+
+
+typedef boolean
+(*test_func_t)(const struct util_format_test_case *test);
+
+
+static boolean
+test_one(test_func_t func, const char *suffix)
+{
+ enum pipe_format last_format = PIPE_FORMAT_NONE;
+ unsigned i;
+ bool success = TRUE;
+
+ for (i = 0; i < util_format_nr_test_cases; ++i) {
+ const struct util_format_test_case *test = &util_format_test_cases[i];
+ if (test->format != last_format) {
+ const struct util_format_description *format_desc;
+ format_desc = util_format_description(test->format);
+ printf("Testing util_format_%s_%s ...\n", format_desc->short_name, suffix);
+ last_format = test->format;
+ }
+
+ if (!func(&util_format_test_cases[i]))
+ success = FALSE;
+ }
+
+ return success;
+}
+
+
+static boolean
+test_all(void)
+{
+ bool success = TRUE;
+
+ if (!test_one(&test_format_pack_4f, "pack_4f"))
+ success = FALSE;
+
+ if (!test_one(&test_format_unpack_4f, "unpack_4f"))
+ success = FALSE;
+
+ if (!test_one(&test_format_pack_4ub, "pack_4ub"))
+ success = FALSE;
+
+ if (!test_one(&test_format_unpack_4ub, "unpack_4ub"))
+ success = FALSE;
+
+ return success;
+}
+
+
+int main(int argc, char **argv)
+{
+ boolean success;
+
+ success = test_all();
+
+ return success ? 0 : 1;
+}
diff --git a/progs/ggi/asc-view.c b/progs/ggi/asc-view.c
deleted file mode 100644
index d37fba9d9f7..00000000000
--- a/progs/ggi/asc-view.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- test program for the ggi-mesa driver
-
- Copyright (C) 1997,1998 Uwe Maurer - [email protected]
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <sys/time.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <GL/gl.h>
-#include <GL/ggimesa.h>
-#include <ggi/ggi.h>
-#include <stdlib.h>
-
-ggi_visual_t vis,vis_mem;
-
-GGIMesaContext ctx;
-
-int screen_x=GGI_AUTO,screen_y=GGI_AUTO;
-ggi_graphtype bpp=GT_AUTO;
-
-//#define ZBUFFER
-
-//#define SMOOTH_NORMALS
-
-void Init()
-{
- GLfloat h=(GLfloat)3/4;
- GLfloat pos[4]={5,5,-20,0};
- GLfloat specular[4]={.4,.4,.4,1};
- GLfloat diffuse[4]={.3,.3,.3,1};
- GLfloat ambient[4]={.2,.2,.2,1};
-
- int err;
-
- if (ggiInit()<0)
- {
- printf("ggiInit() failed\n");
- exit(1);
- }
- ctx=GGIMesaCreateContext();
- if (ctx==NULL)
- {
- printf("Can't create Context!\n");
- exit(1);
- }
-
- vis=ggiOpen(NULL);
- vis_mem=ggiOpen("display-memory",NULL);
- if (vis==NULL || vis_mem==NULL)
- {
- printf("Can't open ggi_visuals!\n");
- exit(1);
- }
- err=ggiSetGraphMode(vis,screen_x,screen_y,screen_x,screen_y,bpp);
- err+=ggiSetGraphMode(vis_mem,screen_x,screen_y,screen_x,screen_y,bpp);
- if (err)
- {
- printf("Can't set %ix%i\n",screen_x,screen_y);
- exit(1);
- }
-
- if (GGIMesaSetVisual(ctx,vis_mem,GL_TRUE,GL_FALSE)<0)
- {
- printf("GGIMesaSetVisual() failed!\n");
- exit(1);
- }
-
- GGIMesaMakeCurrent(ctx);
-
- glViewport(0,0,screen_x,screen_y);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1,1,-h,h,1,50);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0,0,-9);
- glShadeModel(GL_FLAT);
-
- glFrontFace(GL_CW);
- glEnable(GL_CULL_FACE);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
-
- glLightfv(GL_LIGHT0,GL_POSITION,pos);
-
- glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuse);
- glLightfv(GL_LIGHT0,GL_AMBIENT,ambient);
- glLightfv(GL_LIGHT0,GL_SPECULAR,specular);
-
- #ifdef ZBUFFER
- glEnable(GL_DEPTH_TEST);
- #endif
-}
-
-
-#define MAX_VERTS 1000
-#define MAX_TRIS 2000
-#define MAX_LEN 1024
-#define MAX_F 100000000
-
-void LoadAsc(GLuint *list,char *file)
-{
- FILE *fp;
-
- GLfloat p[MAX_VERTS][3];
- GLfloat normal[MAX_VERTS][3];
- float ncount[MAX_VERTS];
- int v[MAX_TRIS][3];
- char line[MAX_LEN];
- char *s;
- int i,j;
- int verts,faces;
- GLuint v0,v1,v2;
- GLfloat n[3];
- GLfloat len,k;
- GLfloat min[3]={MAX_F,MAX_F,MAX_F};
- GLfloat max[3]={-MAX_F,-MAX_F,-MAX_F};
- char *coord_str[]={"X","Z","Y"};
-
- fp=fopen(file,"r");
- if (!fp)
- {
- printf("Can't open %s!\n",file);
- exit(1);
- }
-
- while (strncmp(fgets(line,MAX_LEN,fp),"Tri-mesh",8)) ;
-
- s=strstr(line,":")+1;
- verts=atoi(s);
- s=strstr(s,":")+1;
- faces=atoi(s);
-
- if (verts>MAX_VERTS)
- {
- printf("Too many vertices..\n");
- exit(1);
- }
-
- while (strncmp(fgets(line,MAX_LEN,fp),"Vertex list",11)) ;
-
- for (i=0;i<verts;i++)
- {
- while (strncmp(fgets(line,MAX_LEN,fp),"Vertex",6)) ;
- for (j=0;j<3;j++)
- {
- s=strstr(line,coord_str[j])+2;
- k=atoi(s);
- if (k>max[j]) max[j]=k;
- if (k<min[j]) min[j]=k;
- p[i][j]=k;
- }
-
- }
- len=0;
- for (i=0;i<3;i++)
- {
- k=max[i]-min[i];
- if (k>len) {len=k;j=i;}
- n[i]=(max[i]+min[i])/2;
- }
-
- len/=2;
-
- for (i=0;i<verts;i++)
- {
- for (j=0;j<3;j++)
- {
- p[i][j]-=n[j];
- p[i][j]/=len;
- }
- }
-
- *list=glGenLists(1);
- glNewList(*list,GL_COMPILE);
- glBegin(GL_TRIANGLES);
-
- memset(ncount,0,sizeof(ncount));
- memset(normal,0,sizeof(normal));
-
- while (strncmp(fgets(line,MAX_LEN,fp),"Face list",9)) ;
- for (i=0;i<faces;i++)
- {
- while (strncmp(fgets(line,MAX_LEN,fp),"Face",4)) ;
- s=strstr(line,"A")+2;
- v0=v[i][0]=atoi(s);
- s=strstr(line,"B")+2;
- v1=v[i][1]=atoi(s);
- s=strstr(line,"C")+2;
- v2=v[i][2]=atoi(s);
- n[0]=((p[v1][1]-p[v0][1])*(p[v2][2]-p[v0][2])
- - (p[v1][2]-p[v0][2])*(p[v2][1]-p[v0][1]));
- n[1]=((p[v1][2]-p[v0][2])*(p[v2][0]-p[v0][0])
- - (p[v1][0]-p[v0][0])*(p[v2][2]-p[v0][2]));
- n[2]=((p[v1][0]-p[v0][0])*(p[v2][1]-p[v0][1])
- - (p[v1][1]-p[v0][1])*(p[v2][0]-p[v0][0]));
- len=n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
- len=sqrt(len);
- n[0]/=len;
- n[1]/=len;
- n[2]/=len;
- #ifdef SMOOTH_NORMALS
- for (j=0;j<3;j++){
- normal[v[i][j]][0]+=n[0];
- normal[v[i][j]][1]+=n[1];
- normal[v[i][j]][2]+=n[2];
- ncount[v[i][j]]++;
- }
- #else
- glNormal3fv(n);
- for (j=0;j<3;j++)
- glVertex3fv(p[v[i][j]]);
- #endif
- }
-
- #ifdef SMOOTH_NORMALS
- for (i=0;i<verts;i++) {
- for (j=0;j<3;j++) {
- normal[i][j]/=ncount[i];
- }
- }
- for (i=0;i<faces;i++) {
- for (j=0;j<3;j++) {
- glNormal3f(normal[v[i][j]][0],
- normal[v[i][j]][1],
- normal[v[i][j]][2]);
- glVertex3fv(p[v[i][j]]);
- }
- }
- #endif
-
- glEnd();
- glEndList();
- fclose(fp);
-}
-
-double Display(GLuint l,int *maxframes)
-{
- int x,y;
- GLfloat col[]={.25,0,.25,1};
- int frames=0;
- struct timeval start,stop;
- double len;
- GLfloat rotate=0;
-
- gettimeofday(&start,NULL);
-
-
- while(1)
- {
- glClearColor(0,0,0,0);
- glClearIndex(0);
-
- #ifdef ZBUFFER
- glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
- #else
- glClear(GL_COLOR_BUFFER_BIT);
- #endif
-
- glPushMatrix();
-
- glRotatef(30,1,0,0);
- glRotatef(rotate/10,0,0,1);
- glTranslatef(-6,-4,0);
- for (y=0;y<3;y++)
- {
- glPushMatrix();
- for (x=0;x<5;x++)
- {
- glPushMatrix();
- glRotatef(rotate,y+1,-x-1,0);
-
- col[0]=(GLfloat)(x+1)/4;
- col[1]=0;
- col[2]=(GLfloat)(y+1)/2;
- glMaterialfv(GL_FRONT,GL_AMBIENT,col);
- glCallList(l);
- glPopMatrix();
- glTranslatef(3,0,0);
- }
- glPopMatrix();
- glTranslatef(0,4,0);
- }
- glPopMatrix();
- glFinish();
-
- ggiPutBox(vis,0,0,screen_x,screen_y,ggiDBGetBuffer(vis,0)->read);
- rotate+=10;
- frames++;
- if (frames==(*maxframes)) break;
-
- if (ggiKbhit(vis))
- {
- *maxframes=frames;
- break;
- }
- }
-
- gettimeofday(&stop,NULL);
- len=(double)(stop.tv_sec-start.tv_sec)+
- (double)(stop.tv_usec-start.tv_usec)/1e6;
- return len;
-}
-
-void visible(int vis)
-{
- if (vis == GLUT_VISIBLE)
- glutIdleFunc(idle);
- else
- glutIdleFunc(NULL);
-}
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
-
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(300, 300);
- glutCreateWindow("asc-view");
- init();
-
- glutDisplayFunc(draw);
- glutReshapeFunc(reshape);
- glutKeyboardFunc(key);
- glutSpecialFunc(special);
- glutVisibilityFunc(visible);
-
- glutMainLoop();
-#if 0
- GLuint l;
- char *file;
- int maxframes=0;
- double len;
-
- Init();
-
- file=(argc>1) ? argv[1] : "asc/box.asc";
- if (argc>2) maxframes=atoi(argv[2]);
-
- if (argc==1)
- {
- printf("usage: %s filename.asc\n",argv[0]);
- }
-
- LoadAsc(&l,file);
-
- len=Display(l,&maxframes);
-
- printf("\ttime: %.3f sec\n",len);
- printf("\tframes: %i\n",maxframes);
- printf("\tfps: %.3f \n",(double)maxframes/len);
-
- GGIMesaDestroyContext(ctx);
- ggiClose(vis);
- ggiClose(vis_mem);
- ggiExit();
-#endif
- return 0;
-}
-
diff --git a/progs/ggi/blah b/progs/ggi/blah
deleted file mode 100644
index 2c1664d7d05..00000000000
--- a/progs/ggi/blah
+++ /dev/null
@@ -1,2 +0,0 @@
-Terminating on signal 11
-
diff --git a/progs/ggi/blat b/progs/ggi/blat
deleted file mode 100644
index 7ff64a9d10d..00000000000
--- a/progs/ggi/blat
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-function foobar() {
- echo "foo!"
-}
-
-foobar
diff --git a/progs/ggi/box.asc b/progs/ggi/box.asc
deleted file mode 100644
index f8b23fd85af..00000000000
--- a/progs/ggi/box.asc
+++ /dev/null
@@ -1,66 +0,0 @@
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 8 Faces: 12
-Vertex list:
-Vertex 0: X: -20 Y: -19.999998 Z: 20.000002
-Vertex 1: X: 20 Y: -19.999998 Z: 20.000002
-Vertex 2: X: 20 Y: 20.000002 Z: 19.999998
-Vertex 3: X: -20 Y: 20.000002 Z: 19.999998
-Vertex 4: X: -20 Y: -20.000002 Z: -19.999998
-Vertex 5: X: 20 Y: -20.000002 Z: -19.999998
-Vertex 6: X: 20 Y: 19.999998 Z: -20.000002
-Vertex 7: X: -20 Y: 19.999998 Z: -20.000002
-Face list:
-Face 0: A:0 B:1 C:2 AB:1 BC:1 CA:0
-Smoothing: 1
-Face 1: A:0 B:2 C:3 AB:0 BC:1 CA:1
-Smoothing: 1
-Face 2: A:0 B:4 C:5 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 3: A:0 B:5 C:1 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 4: A:1 B:5 C:6 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 5: A:1 B:6 C:2 AB:0 BC:1 CA:1
-Smoothing: 3
-Face 6: A:2 B:6 C:7 AB:1 BC:1 CA:0
-Smoothing: 4
-Face 7: A:2 B:7 C:3 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 8: A:3 B:7 C:4 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 9: A:3 B:4 C:0 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 10: A:4 B:7 C:6 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 11: A:4 B:6 C:5 AB:0 BC:1 CA:1
-Smoothing: 6
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 1
-
-
-
diff --git a/progs/ggi/cone.asc b/progs/ggi/cone.asc
deleted file mode 100644
index 5c522859963..00000000000
--- a/progs/ggi/cone.asc
+++ /dev/null
@@ -1,198 +0,0 @@
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 34 Faces: 64
-Vertex list:
-Vertex 0: X: 60.167416 Y: -87.419525 Z: -53.3088
-Vertex 1: X: 76.70787 Y: -87.419518 Z: -29.84565
-Vertex 2: X: 83.0103 Y: -87.419518 Z: -1.838764
-Vertex 3: X: 78.115204 Y: -87.419518 Z: 26.448057
-Vertex 4: X: 62.767834 Y: -87.41951 Z: 50.708401
-Vertex 5: X: 39.304672 Y: -87.41951 Z: 67.248848
-Vertex 6: X: 11.297782 Y: -87.41951 Z: 73.551254
-Vertex 7: X: -16.989004 Y: -87.41951 Z: 68.656158
-Vertex 8: X: -41.249344 Y: -87.41951 Z: 53.308777
-Vertex 9: X: -57.789783 Y: -87.419518 Z: 29.845612
-Vertex 10: X: -64.092194 Y: -87.419518 Z: 1.838721
-Vertex 11: X: -59.197079 Y: -87.419518 Z: -26.448097
-Vertex 12: X: -43.849678 Y: -87.419525 Z: -50.708427
-Vertex 13: X: -20.386503 Y: -87.419525 Z: -67.248856
-Vertex 14: X: 7.62039 Y: -87.419525 Z: -73.551239
-Vertex 15: X: 35.907204 Y: -87.419525 Z: -68.656105
-Vertex 16: X: 101.684875 Y: 94.590591 Z: -96.955391
-Vertex 17: X: 131.767838 Y: 94.590591 Z: -54.281792
-Vertex 18: X: 143.230377 Y: 94.590599 Z: -3.344275
-Vertex 19: X: 134.327423 Y: 94.590607 Z: 48.102379
-Vertex 20: X: 106.414383 Y: 94.590607 Z: 92.225876
-Vertex 21: X: 63.740765 Y: 94.590607 Z: 122.3088
-Vertex 22: X: 12.803238 Y: 94.590614 Z: 133.771301
-Vertex 23: X: -38.643349 Y: 94.590607 Z: 124.868355
-Vertex 24: X: -82.766846 Y: 94.590607 Z: 96.955307
-Vertex 25: X: -112.849762 Y: 94.590607 Z: 54.281677
-Vertex 26: X: -124.312256 Y: 94.590599 Z: 3.344152
-Vertex 27: X: -115.409271 Y: 94.590591 Z: -48.102493
-Vertex 28: X: -87.496201 Y: 94.590591 Z: -92.225967
-Vertex 29: X: -44.822552 Y: 94.590591 Z: -122.308861
-Vertex 30: X: 6.114983 Y: 94.590584 Z: -133.771332
-Vertex 31: X: 57.561623 Y: 94.590591 Z: -124.868301
-Vertex 32: X: 9.459057 Y: -87.419518 Z: 0.000008
-Vertex 33: X: 9.459057 Y: 94.590599 Z: -0.000008
-Face list:
-Face 0: A:0 B:1 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 1: A:1 B:2 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 2: A:2 B:3 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 3: A:3 B:4 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 4: A:4 B:5 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 5: A:5 B:6 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 6: A:6 B:7 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 7: A:7 B:8 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 8: A:8 B:9 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 9: A:9 B:10 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 10: A:10 B:11 C:32 AB:1 BC:0 CA:0
-
- Page 1
-
-
-
-Smoothing: 1
-Face 11: A:11 B:12 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 12: A:12 B:13 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 13: A:13 B:14 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 14: A:14 B:15 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 15: A:15 B:0 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 16: A:0 B:16 C:17 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 17: A:0 B:17 C:1 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 18: A:1 B:17 C:18 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 19: A:1 B:18 C:2 AB:0 BC:1 CA:1
-Smoothing: 3
-Face 20: A:2 B:18 C:19 AB:1 BC:1 CA:0
-Smoothing: 4
-Face 21: A:2 B:19 C:3 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 22: A:3 B:19 C:20 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 23: A:3 B:20 C:4 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 24: A:4 B:20 C:21 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 25: A:4 B:21 C:5 AB:0 BC:1 CA:1
-Smoothing: 6
-Face 26: A:5 B:21 C:22 AB:1 BC:1 CA:0
-Smoothing: 7
-Face 27: A:5 B:22 C:6 AB:0 BC:1 CA:1
-Smoothing: 7
-Face 28: A:6 B:22 C:23 AB:1 BC:1 CA:0
-Smoothing: 8
-Face 29: A:6 B:23 C:7 AB:0 BC:1 CA:1
-Smoothing: 8
-Face 30: A:7 B:23 C:24 AB:1 BC:1 CA:0
-Smoothing: 9
-Face 31: A:7 B:24 C:8 AB:0 BC:1 CA:1
-Smoothing: 9
-Face 32: A:8 B:24 C:25 AB:1 BC:1 CA:0
-Smoothing: 10
-Face 33: A:8 B:25 C:9 AB:0 BC:1 CA:1
-Smoothing: 10
-Face 34: A:9 B:25 C:26 AB:1 BC:1 CA:0
-Smoothing: 11
-Face 35: A:9 B:26 C:10 AB:0 BC:1 CA:1
-Smoothing: 11
-Face 36: A:10 B:26 C:27 AB:1 BC:1 CA:0
-Smoothing: 12
-Face 37: A:10 B:27 C:11 AB:0 BC:1 CA:1
-Smoothing: 12
-Face 38: A:11 B:27 C:28 AB:1 BC:1 CA:0
-Smoothing: 13
-Face 39: A:11 B:28 C:12 AB:0 BC:1 CA:1
-Smoothing: 13
-Face 40: A:12 B:28 C:29 AB:1 BC:1 CA:0
-Smoothing: 14
-
- Page 2
-
-
-
-Face 41: A:12 B:29 C:13 AB:0 BC:1 CA:1
-Smoothing: 14
-Face 42: A:13 B:29 C:30 AB:1 BC:1 CA:0
-Smoothing: 15
-Face 43: A:13 B:30 C:14 AB:0 BC:1 CA:1
-Smoothing: 15
-Face 44: A:14 B:30 C:31 AB:1 BC:1 CA:0
-Smoothing: 16
-Face 45: A:14 B:31 C:15 AB:0 BC:1 CA:1
-Smoothing: 16
-Face 46: A:15 B:31 C:16 AB:1 BC:1 CA:0
-Smoothing: 17
-Face 47: A:15 B:16 C:0 AB:0 BC:1 CA:1
-Smoothing: 17
-Face 48: A:16 B:33 C:17 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 49: A:17 B:33 C:18 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 50: A:18 B:33 C:19 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 51: A:19 B:33 C:20 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 52: A:20 B:33 C:21 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 53: A:21 B:33 C:22 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 54: A:22 B:33 C:23 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 55: A:23 B:33 C:24 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 56: A:24 B:33 C:25 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 57: A:25 B:33 C:26 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 58: A:26 B:33 C:27 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 59: A:27 B:33 C:28 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 60: A:28 B:33 C:29 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 61: A:29 B:33 C:30 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 62: A:30 B:33 C:31 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 63: A:31 B:33 C:16 AB:0 BC:0 CA:1
-Smoothing: 18
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 3
-
-
-
diff --git a/progs/ggi/gears.c b/progs/ggi/gears.c
deleted file mode 100644
index 2b3231d8ae6..00000000000
--- a/progs/ggi/gears.c
+++ /dev/null
@@ -1,339 +0,0 @@
-
-/*
- * 3-D gear wheels. This program is in the public domain.
- *
- * Brian Paul
- */
-
-/* Conversion to GLUT by Mark J. Kilgard */
-
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <GL/glut.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265
-#endif
-
-static GLint T0 = 0;
-static GLint Frames = 0;
-
-
-/**
-
- Draw a gear wheel. You'll probably want to call this function when
- building a display list since we do a lot of trig here.
-
- Input: inner_radius - radius of hole at center
- outer_radius - radius at center of teeth
- width - width of gear
- teeth - number of teeth
- tooth_depth - depth of tooth
-
- **/
-
-static void
-gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
- GLint teeth, GLfloat tooth_depth)
-{
- GLint i;
- GLfloat r0, r1, r2;
- GLfloat angle, da;
- GLfloat u, v, len;
-
- r0 = inner_radius;
- r1 = outer_radius - tooth_depth / 2.0;
- r2 = outer_radius + tooth_depth / 2.0;
-
- da = 2.0 * M_PI / teeth / 4.0;
-
- glShadeModel(GL_FLAT);
-
- glNormal3f(0.0, 0.0, 1.0);
-
- /* draw front face */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- if (i < teeth) {
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
- }
- }
- glEnd();
-
- /* draw front sides of teeth */
- glBegin(GL_QUADS);
- da = 2.0 * M_PI / teeth / 4.0;
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
- }
- glEnd();
-
- glNormal3f(0.0, 0.0, -1.0);
-
- /* draw back face */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- if (i < teeth) {
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- }
- }
- glEnd();
-
- /* draw back sides of teeth */
- glBegin(GL_QUADS);
- da = 2.0 * M_PI / teeth / 4.0;
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- }
- glEnd();
-
- /* draw outward faces of teeth */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- u = r2 * cos(angle + da) - r1 * cos(angle);
- v = r2 * sin(angle + da) - r1 * sin(angle);
- len = sqrt(u * u + v * v);
- u /= len;
- v /= len;
- glNormal3f(v, -u, 0.0);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
- glNormal3f(cos(angle), sin(angle), 0.0);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
- u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
- v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
- glNormal3f(v, -u, 0.0);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
- glNormal3f(cos(angle), sin(angle), 0.0);
- }
-
- glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
- glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
-
- glEnd();
-
- glShadeModel(GL_SMOOTH);
-
- /* draw inside radius cylinder */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glNormal3f(-cos(angle), -sin(angle), 0.0);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- }
- glEnd();
-
-}
-
-static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
-static GLint gear1, gear2, gear3;
-static GLfloat angle = 0.0;
-
-static void
-draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix();
- glRotatef(view_rotx, 1.0, 0.0, 0.0);
- glRotatef(view_roty, 0.0, 1.0, 0.0);
- glRotatef(view_rotz, 0.0, 0.0, 1.0);
-
- glPushMatrix();
- glTranslatef(-3.0, -2.0, 0.0);
- glRotatef(angle, 0.0, 0.0, 1.0);
- glCallList(gear1);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(3.1, -2.0, 0.0);
- glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
- glCallList(gear2);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(-3.1, 4.2, 0.0);
- glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
- glCallList(gear3);
- glPopMatrix();
-
- glPopMatrix();
-
- glutSwapBuffers();
-
- Frames++;
- {
- GLint t = glutGet(GLUT_ELAPSED_TIME);
- if (t - T0 >= 5000) {
- GLfloat seconds = (t - T0) / 1000.0;
- GLfloat fps = Frames / seconds;
- printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps);
- T0 = t;
- Frames = 0;
- }
- }
-}
-
-
-static void
-idle(void)
-{
- angle += 2.0;
- glutPostRedisplay();
-}
-
-/* change view angle, exit upon ESC */
-/* ARGSUSED1 */
-static void
-key(unsigned char k, int x, int y)
-{
- switch (k) {
- case 'z':
- view_rotz += 5.0;
- break;
- case 'Z':
- view_rotz -= 5.0;
- break;
- case 27: /* Escape */
- exit(0); /* FIXME: Shutdown and free resources cleanly in ggiglut */
- break;
- default:
- return;
- }
- glutPostRedisplay();
-}
-
-/* change view angle */
-/* ARGSUSED1 */
-static void
-special(int k, int x, int y)
-{
- switch (k) {
- case GLUT_KEY_UP:
- view_rotx += 5.0;
- break;
- case GLUT_KEY_DOWN:
- view_rotx -= 5.0;
- break;
- case GLUT_KEY_LEFT:
- view_roty += 5.0;
- break;
- case GLUT_KEY_RIGHT:
- view_roty -= 5.0;
- break;
- default:
- return;
- }
- glutPostRedisplay();
-}
-
-/* new window size or exposure */
-static void
-reshape(int width, int height)
-{
- GLfloat h = (GLfloat) height / (GLfloat) width;
-
- glViewport(0, 0, (GLint) width, (GLint) height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -40.0);
-}
-
-static void
-init(void)
-{
- static GLfloat pos[4] =
- {5.0, 5.0, 10.0, 0.0};
- static GLfloat red[4] =
- {0.8, 0.1, 0.0, 1.0};
- static GLfloat green[4] =
- {0.0, 0.8, 0.2, 1.0};
- static GLfloat blue[4] =
- {0.2, 0.2, 1.0, 1.0};
-
- glLightfv(GL_LIGHT0, GL_POSITION, pos);
- glEnable(GL_CULL_FACE);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- /* make the gears */
- gear1 = glGenLists(1);
- glNewList(gear1, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
- gear(1.0, 4.0, 1.0, 20, 0.7);
- glEndList();
-
- gear2 = glGenLists(1);
- glNewList(gear2, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
- gear(0.5, 2.0, 2.0, 10, 0.7);
- glEndList();
-
- gear3 = glGenLists(1);
- glNewList(gear3, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
- gear(1.3, 2.0, 0.5, 10, 0.7);
- glEndList();
-
- glEnable(GL_NORMALIZE);
-}
-
-void
-visible(int vis)
-{
- if (vis == GLUT_VISIBLE)
- glutIdleFunc(idle);
- else
- glutIdleFunc(NULL);
-}
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
-
-// glutInitWindowPosition(0, 0);
-// glutInitWindowSize(300, 300);
- glutCreateWindow("Gears");
- init();
-
- glutDisplayFunc(draw);
- glutReshapeFunc(reshape);
- glutKeyboardFunc(key);
- glutSpecialFunc(special);
- glutVisibilityFunc(visible);
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/progs/ggi/gears2.c b/progs/ggi/gears2.c
deleted file mode 100644
index 9468c031777..00000000000
--- a/progs/ggi/gears2.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/* gears.c */
-
-/*
- * 3-D gear wheels. This program is in the public domain.
- *
- * Brian Paul
- * modified by Uwe Maurer ([email protected])
- */
-
-#include <string.h>
-#include <math.h>
-#include <stdlib.h>
-#include <ggi/ggi.h>
-#include <GL/ggimesa.h>
-#ifndef M_PI
-# define M_PI 3.14159265
-#endif
-
-
-ggi_visual_t vis;
-char text[100];
-int db_flag,vis_x, vis_y, vir_x, vir_y, gt;
-
-/*
- * Draw a gear wheel. You'll probably want to call this function when
- * building a display list since we do a lot of trig here.
- *
- * Input: inner_radius - radius of hole at center
- * outer_radius - radius at center of teeth
- * width - width of gear
- * teeth - number of teeth
- * tooth_depth - depth of tooth
- */
-static void gear( GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
- GLint teeth, GLfloat tooth_depth )
-{
- GLint i;
- GLfloat r0, r1, r2;
- GLfloat angle, da;
- GLfloat u, v, len;
-
- r0 = inner_radius;
- r1 = outer_radius - tooth_depth/2.0;
- r2 = outer_radius + tooth_depth/2.0;
-
- da = 2.0*M_PI / teeth / 4.0;
-
- glShadeModel( GL_FLAT );
-
- glNormal3f( 0.0, 0.0, 1.0 );
-
- /* draw front face */
- glBegin( GL_QUAD_STRIP );
- for (i=0;i<=teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
- glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
- glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
- glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
- }
- glEnd();
-
- /* draw front sides of teeth */
- glBegin( GL_QUADS );
- da = 2.0*M_PI / teeth / 4.0;
- for (i=0;i<teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
-
- glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
- glVertex3f( r2*cos(angle+da), r2*sin(angle+da), width*0.5 );
- glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
- }
- glEnd();
-
-
- glNormal3f( 0.0, 0.0, -1.0 );
-
- /* draw back face */
- glBegin( GL_QUAD_STRIP );
- for (i=0;i<=teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
- glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
- glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
- glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
- }
- glEnd();
-
- /* draw back sides of teeth */
- glBegin( GL_QUADS );
- da = 2.0*M_PI / teeth / 4.0;
- for (i=0;i<teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
-
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
- glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
- glVertex3f( r2*cos(angle+da), r2*sin(angle+da), -width*0.5 );
- glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
- }
- glEnd();
-
-
- /* draw outward faces of teeth */
- glBegin( GL_QUAD_STRIP );
- for (i=0;i<teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
-
- glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
- glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
- u = r2*cos(angle+da) - r1*cos(angle);
- v = r2*sin(angle+da) - r1*sin(angle);
- len = sqrt( u*u + v*v );
- u /= len;
- v /= len;
- glNormal3f( v, -u, 0.0 );
- glVertex3f( r2*cos(angle+da), r2*sin(angle+da), width*0.5 );
- glVertex3f( r2*cos(angle+da), r2*sin(angle+da), -width*0.5 );
- glNormal3f( cos(angle), sin(angle), 0.0 );
- glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
- glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
- u = r1*cos(angle+3*da) - r2*cos(angle+2*da);
- v = r1*sin(angle+3*da) - r2*sin(angle+2*da);
- glNormal3f( v, -u, 0.0 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
- glNormal3f( cos(angle), sin(angle), 0.0 );
- }
-
- glVertex3f( r1*cos(0), r1*sin(0), width*0.5 );
- glVertex3f( r1*cos(0), r1*sin(0), -width*0.5 );
-
- glEnd();
-
-
- glShadeModel( GL_SMOOTH );
-
- /* draw inside radius cylinder */
- glBegin( GL_QUAD_STRIP );
- for (i=0;i<=teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
- glNormal3f( -cos(angle), -sin(angle), 0.0 );
- glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
- glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
- }
- glEnd();
-
-}
-
-
-static GLfloat view_rotx=20.0, view_roty=30.0, view_rotz=0.0;
-static GLint gear1, gear2, gear3;
-static GLfloat angle = 0.0;
-
-static GLuint limit;
-static GLuint count = 1;
-
-
-static void draw( void )
-{
- static int n = 0;
- glClearColor(0,0,0,0);
- glClearIndex(0);
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef( view_rotx, 1.0, 0.0, 0.0 );
- glRotatef( view_roty, 0.0, 1.0, 0.0 );
- glRotatef( view_rotz, 0.0, 0.0, 1.0 );
-
- glPushMatrix();
- glTranslatef( -3.0, -2.0, 0.0 );
- glRotatef( angle, 0.0, 0.0, 1.0 );
- glCallList(gear1);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef( 3.1, -2.0, 0.0 );
- glRotatef( -2.0*angle-9.0, 0.0, 0.0, 1.0 );
- glCallList(gear2);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef( -3.1, 4.2, 0.0 );
- glRotatef( -2.0*angle-25.0, 0.0, 0.0, 1.0 );
- glCallList(gear3);
- glPopMatrix();
-
- glPopMatrix();
- glFlush();
- glFinish();
-
-#if 0
- ggiSetGCForeground(vis,255);
- ggiPuts(vis,0,0,"Mesa -> GGI");
- ggiPuts(vis,0,ggiGetInfo(vis)->mode->visible.y," Mesa -> GGI");
-
- ggiPuts(vis,0,16,text);
- ggiPuts(vis,0,ggiGetInfo(vis)->mode->visible.y+16,text);
-#endif
-
- if(db_flag)
- ggiMesaSwapBuffers();
-
- count++;
- if (count==limit) {
- exit(1);
- }
- ++n;
- /*
- if (!(n%10)){
- ggi_color rgb = { 10000, 10000, 10000 };
- ggiSetSimpleMode(vis,vis_x+(n/10),vis_y+(n/10),db_flag?2:1, gt);
- glViewport(0, 0,vis_x+(n/10),vis_y+(n/10));
- ggiSetGCForeground(vis, ggiMapColor(vis, &rgb));
- ggiDrawBox(vis, 20, 20, 100, 100);
- if(db_flag)
- ggiSetWriteFrame(vis, 1);
- }
- */
-}
-
-static void idle( void )
-{
- angle += 2.0;
- draw();
-}
-
-/* new window size or exposure */
-static void reshape( int width, int height )
-{
- GLfloat h = (GLfloat) height / (GLfloat) width;
-
- if(db_flag)
- glDrawBuffer(GL_BACK);
- else
- glDrawBuffer(GL_FRONT);
- glViewport(0, 0, (GLint)width, (GLint)height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -h, h, 5.0, 60.0 );
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -40.0 );
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
-}
-
-
-static void init( void )
-{
- static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0 };
- static GLfloat red[4] = {0.9, 0.9, 0.9, 1.0 };
- static GLfloat green[4] = {0.0, 0.8, 0.9, 1.0 };
- static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0 };
-
- glLightfv( GL_LIGHT0, GL_POSITION, pos );
- glEnable( GL_CULL_FACE );
- glEnable( GL_LIGHTING );
- glEnable( GL_LIGHT0 );
- glEnable( GL_DEPTH_TEST );
-
- /* make the gears */
- gear1 = glGenLists(1);
- glNewList(gear1, GL_COMPILE);
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red );
- glIndexi(1);
- gear( 1.0, 4.0, 1.0, 20, 0.7 );
- glEndList();
-
- gear2 = glGenLists(1);
- glNewList(gear2, GL_COMPILE);
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green );
- glIndexi(2);
- gear( 0.5, 2.0, 2.0, 10, 0.7 );
- glEndList();
-
- gear3 = glGenLists(1);
- glNewList(gear3, GL_COMPILE);
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue );
- glIndexi(3);
- gear( 1.3, 2.0, 0.5, 10, 0.7 );
- glEndList();
-
- glEnable( GL_NORMALIZE );
-}
-
-static void usage(char *s)
-{
- printf("%s visible_x visible_y virtual_x virtual_y bpp db_flag\n",s);
- printf("example:\n");
- printf("%s 320 200 320 400 8 1\n",s);
- exit(1);
-}
-
-int main( int argc, char *argv[] )
-{
- ggi_mesa_context_t ctx;
- ggi_mode mode;
- int bpp;
-
- limit=0;
-
- if (argc<7) usage(argv[0]);
-
- vis_x=atoi(argv[1]);
- vis_y=atoi(argv[2]);
- vir_x=atoi(argv[3]);
- vir_y=atoi(argv[4]);
- bpp=atoi(argv[5]);
- db_flag=atoi(argv[6]);
-
- switch(bpp)
- {
- case 4: gt=GT_4BIT;break;
- case 8: gt=GT_8BIT;break;
- case 15:gt=GT_15BIT;break;
- case 16:gt=GT_16BIT;break;
- case 24:gt=GT_24BIT;break;
- case 32:gt=GT_32BIT;break;
- default:
- printf("%i Bits per Pixel ???\n",bpp);
- exit(1);
- }
- sprintf(text,"%sx%s %i colors, RGB mode, %s",
- argv[1],argv[2],1<<bpp,
- (db_flag) ? "doublebuffer" : "no doublebuffer");
-
- if (ggiInit()<0)
- {
- printf("ggiInit() failed\n");
- exit(1);
- }
-
- if (ggiMesaInit() < 0)
- {
- printf("ggiMesaInit failed\n");
- exit(1);
- }
-
- vis=ggiOpen(NULL);
- if (vis==NULL)
- {
- printf("ggiOpen() failed\n");
- exit(1);
- }
-
- if (ggiSetSimpleMode(vis,vis_x,vis_y,db_flag ? 2 : 1,gt)<0)
- {
- printf("%s: can't set graphmode (%i %i %i %i) %i BPP\n",
- argv[0],vis_x,vis_y,vir_x,vir_y,bpp);
- exit(1);
- }
-
- if (ggiMesaAttach(vis) < 0)
- {
- printf("ggiMesaAttach failed\n");
- exit(1);
- }
- if (ggiMesaExtendVisual(vis, GL_FALSE, GL_FALSE, 16,
- 0, 0, 0, 0, 0, 1) < 0)
- {
- printf ("GGIMesaSetVisual() failed\n");
- exit(1);
- }
-
- ctx = ggiMesaCreateContext(vis);
- if (ctx==NULL)
- {
- printf("GGIMesaCreateContext() failed\n");
- exit(1);
- }
-
- ggiMesaMakeCurrent(ctx, vis);
- ggiGetMode(vis,&mode);
-
- reshape(mode.visible.x,mode.visible.y);
-
- init();
-
- while (!ggiKbhit(vis)) { /*sleep(1);*/ idle(); }
-
- ggiMesaDestroyContext(ctx);
- ggiClose(vis);
-
- printf("%s\n",text);
-
- ggiExit();
- return 0;
-}
diff --git a/progs/ggi/sphere.asc b/progs/ggi/sphere.asc
deleted file mode 100644
index cf7cebf2249..00000000000
--- a/progs/ggi/sphere.asc
+++ /dev/null
@@ -1,132 +0,0 @@
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 20 Faces: 36
-Vertex list:
-Vertex 0: X: -210 Y: -432.781738 Z: 180.000031
-Vertex 1: X: -610.810303 Y: 144.260559 Z: 103.580154
-Vertex 2: X: 56.586655 Y: 144.260544 Z: -128.902023
-Vertex 3: X: -75.776352 Y: 144.260605 Z: 565.321838
-Vertex 4: X: -462.815979 Y: -347.937683 Z: 131.797302
-Vertex 5: X: -616.506042 Y: -126.67173 Z: 102.494209
-Vertex 6: X: -41.847229 Y: -347.937683 Z: -14.843644
-Vertex 7: X: 60.375015 Y: -126.671753 Z: -133.291641
-Vertex 8: X: -125.336807 Y: -347.937653 Z: 423.046448
-Vertex 9: X: -73.868958 Y: -126.671692 Z: 570.797424
-Vertex 10: X: -448.353271 Y: 237.304672 Z: -92.34951
-Vertex 11: X: -192.440964 Y: 237.304672 Z: -181.494431
-Vertex 12: X: 145.038193 Y: 237.304672 Z: 109.754745
-Vertex 13: X: 94.283768 Y: 237.304688 Z: 375.953766
-Vertex 14: X: -326.684937 Y: 237.304733 Z: 522.594727
-Vertex 15: X: -531.842834 Y: 237.304718 Z: 345.540588
-Vertex 16: X: -331.419525 Y: -225.964966 Z: -168.564438
-Vertex 17: X: 152.575485 Y: -225.964935 Z: 249.129868
-Vertex 18: X: -451.155914 Y: -225.964905 Z: 459.434662
-Vertex 19: X: -298.413483 Y: 423.31897 Z: 163.142761
-Face list:
-Face 0: A:0 B:4 C:6 AB:1 BC:1 CA:1
-Face 1: A:4 B:5 C:16 AB:1 BC:1 CA:1
-Face 2: A:4 B:16 C:6 AB:1 BC:1 CA:1
-Face 3: A:6 B:16 C:7 AB:1 BC:1 CA:1
-Face 4: A:5 B:1 C:10 AB:1 BC:1 CA:1
-Face 5: A:5 B:10 C:16 AB:1 BC:1 CA:1
-Face 6: A:16 B:10 C:11 AB:1 BC:1 CA:1
-Face 7: A:16 B:11 C:7 AB:1 BC:1 CA:1
-Face 8: A:7 B:11 C:2 AB:1 BC:1 CA:1
-Face 9: A:0 B:6 C:8 AB:1 BC:1 CA:1
-Face 10: A:6 B:7 C:17 AB:1 BC:1 CA:1
-Face 11: A:6 B:17 C:8 AB:1 BC:1 CA:1
-Face 12: A:8 B:17 C:9 AB:1 BC:1 CA:1
-Face 13: A:7 B:2 C:12 AB:1 BC:1 CA:1
-Face 14: A:7 B:12 C:17 AB:1 BC:1 CA:1
-Face 15: A:17 B:12 C:13 AB:1 BC:1 CA:1
-Face 16: A:17 B:13 C:9 AB:1 BC:1 CA:1
-Face 17: A:9 B:13 C:3 AB:1 BC:1 CA:1
-Face 18: A:0 B:8 C:4 AB:1 BC:1 CA:1
-Face 19: A:8 B:9 C:18 AB:1 BC:1 CA:1
-Face 20: A:8 B:18 C:4 AB:1 BC:1 CA:1
-Face 21: A:4 B:18 C:5 AB:1 BC:1 CA:1
-Face 22: A:9 B:3 C:14 AB:1 BC:1 CA:1
-Face 23: A:9 B:14 C:18 AB:1 BC:1 CA:1
-Face 24: A:18 B:14 C:15 AB:1 BC:1 CA:1
-Face 25: A:18 B:15 C:5 AB:1 BC:1 CA:1
-Face 26: A:5 B:15 C:1 AB:1 BC:1 CA:1
-Face 27: A:1 B:15 C:10 AB:1 BC:1 CA:1
-Face 28: A:15 B:14 C:19 AB:1 BC:1 CA:1
-Face 29: A:15 B:19 C:10 AB:1 BC:1 CA:1
-Face 30: A:10 B:19 C:11 AB:1 BC:1 CA:1
-Face 31: A:14 B:3 C:13 AB:1 BC:1 CA:1
-Face 32: A:14 B:13 C:19 AB:1 BC:1 CA:1
-Face 33: A:19 B:13 C:12 AB:1 BC:1 CA:1
-Face 34: A:19 B:12 C:11 AB:1 BC:1 CA:1
-
- Page 1
-
-
-
-Face 35: A:11 B:12 C:2 AB:1 BC:1 CA:1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 2
-
-
-
diff --git a/progs/ggi/torus.asc b/progs/ggi/torus.asc
deleted file mode 100644
index 605a62baa45..00000000000
--- a/progs/ggi/torus.asc
+++ /dev/null
@@ -1,264 +0,0 @@
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 40 Faces: 80
-Vertex list:
-Vertex 0: X: -50.170624 Y: -0.000026 Z: -240.147842
-Vertex 1: X: -80.584503 Y: -63.958851 Z: -205.014572
-Vertex 2: X: -129.795166 Y: -39.528744 Z: -148.16774
-Vertex 3: X: -129.795166 Y: 39.528721 Z: -148.16774
-Vertex 4: X: -80.584503 Y: 63.958797 Z: -205.014572
-Vertex 5: X: 85.963654 Y: -0.000002 Z: 31.490465
-Vertex 6: X: 39.614838 Y: -63.958828 Z: 34.827602
-Vertex 7: X: -35.37915 Y: -39.528728 Z: 40.227196
-Vertex 8: X: -35.37912 Y: 39.528736 Z: 40.227188
-Vertex 9: X: 39.614838 Y: 63.95882 Z: 34.827595
-Vertex 10: X: -9.852051 Y: 0.000023 Z: 319.829254
-Vertex 11: X: -44.985352 Y: -63.958805 Z: 289.415405
-Vertex 12: X: -101.832199 Y: -39.528709 Z: 240.204758
-Vertex 13: X: -101.832184 Y: 39.528755 Z: 240.204773
-Vertex 14: X: -44.985352 Y: 63.958843 Z: 289.415405
-Vertex 15: X: -281.490326 Y: 0.000035 Z: 455.963654
-Vertex 16: X: -284.827484 Y: -63.958794 Z: 409.614868
-Vertex 17: X: -290.227112 Y: -39.528702 Z: 334.62085
-Vertex 18: X: -290.227112 Y: 39.528763 Z: 334.62088
-Vertex 19: X: -284.827484 Y: 63.958855 Z: 409.614838
-Vertex 20: X: -569.829163 Y: 0.000026 Z: 360.14798
-Vertex 21: X: -539.415344 Y: -63.958801 Z: 325.014709
-Vertex 22: X: -490.204712 Y: -39.528709 Z: 268.167847
-Vertex 23: X: -490.204712 Y: 39.528755 Z: 268.167847
-Vertex 24: X: -539.415344 Y: 63.958847 Z: 325.014679
-Vertex 25: X: -705.963684 Y: 0.000002 Z: 88.509598
-Vertex 26: X: -659.614807 Y: -63.958824 Z: 85.172462
-Vertex 27: X: -584.62085 Y: -39.528725 Z: 79.77285
-Vertex 28: X: -584.62085 Y: 39.52874 Z: 79.77285
-Vertex 29: X: -659.614868 Y: 63.958824 Z: 85.172447
-Vertex 30: X: -610.147827 Y: -0.000023 Z: -199.829361
-Vertex 31: X: -575.014587 Y: -63.958847 Z: -169.415497
-Vertex 32: X: -518.167725 Y: -39.528744 Z: -120.204819
-Vertex 33: X: -518.167725 Y: 39.528721 Z: -120.204834
-Vertex 34: X: -575.014587 Y: 63.958801 Z: -169.415497
-Vertex 35: X: -338.509338 Y: -0.000035 Z: -335.963745
-Vertex 36: X: -335.172241 Y: -63.958858 Z: -289.614868
-Vertex 37: X: -329.772675 Y: -39.528751 Z: -214.620865
-Vertex 38: X: -329.772675 Y: 39.528713 Z: -214.620865
-Vertex 39: X: -335.172241 Y: 63.95879 Z: -289.614899
-Face list:
-Face 0: A:0 B:6 C:1 AB:0 BC:1 CA:1
-Smoothing: 1
-Face 1: A:0 B:5 C:6 AB:1 BC:1 CA:0
-Smoothing: 1
-Face 2: A:1 B:7 C:2 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 3: A:1 B:6 C:7 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 4: A:2 B:8 C:3 AB:0 BC:1 CA:1
-Smoothing: 3
-Face 5: A:2 B:7 C:8 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 6: A:3 B:9 C:4 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 7: A:3 B:8 C:9 AB:1 BC:1 CA:0
-
- Page 1
-
-
-
-Smoothing: 4
-Face 8: A:4 B:5 C:0 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 9: A:4 B:9 C:5 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 10: A:5 B:11 C:6 AB:0 BC:1 CA:1
-Smoothing: 6
-Face 11: A:5 B:10 C:11 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 12: A:6 B:12 C:7 AB:0 BC:1 CA:1
-Smoothing: 7
-Face 13: A:6 B:11 C:12 AB:1 BC:1 CA:0
-Smoothing: 7
-Face 14: A:7 B:13 C:8 AB:0 BC:1 CA:1
-Smoothing: 8
-Face 15: A:7 B:12 C:13 AB:1 BC:1 CA:0
-Smoothing: 8
-Face 16: A:8 B:14 C:9 AB:0 BC:1 CA:1
-Smoothing: 9
-Face 17: A:8 B:13 C:14 AB:1 BC:1 CA:0
-Smoothing: 9
-Face 18: A:9 B:10 C:5 AB:0 BC:1 CA:1
-Smoothing: 10
-Face 19: A:9 B:14 C:10 AB:1 BC:1 CA:0
-Smoothing: 10
-Face 20: A:10 B:16 C:11 AB:0 BC:1 CA:1
-Smoothing: 11
-Face 21: A:10 B:15 C:16 AB:1 BC:1 CA:0
-Smoothing: 11
-Face 22: A:11 B:17 C:12 AB:0 BC:1 CA:1
-Smoothing: 12
-Face 23: A:11 B:16 C:17 AB:1 BC:1 CA:0
-Smoothing: 12
-Face 24: A:12 B:18 C:13 AB:0 BC:1 CA:1
-Smoothing: 13
-Face 25: A:12 B:17 C:18 AB:1 BC:1 CA:0
-Smoothing: 13
-Face 26: A:13 B:19 C:14 AB:0 BC:1 CA:1
-Smoothing: 14
-Face 27: A:13 B:18 C:19 AB:1 BC:1 CA:0
-Smoothing: 14
-Face 28: A:14 B:15 C:10 AB:0 BC:1 CA:1
-Smoothing: 15
-Face 29: A:14 B:19 C:15 AB:1 BC:1 CA:0
-Smoothing: 15
-Face 30: A:15 B:21 C:16 AB:0 BC:1 CA:1
-Smoothing: 16
-Face 31: A:15 B:20 C:21 AB:1 BC:1 CA:0
-Smoothing: 16
-Face 32: A:16 B:22 C:17 AB:0 BC:1 CA:1
-Smoothing: 17
-Face 33: A:16 B:21 C:22 AB:1 BC:1 CA:0
-Smoothing: 17
-Face 34: A:17 B:23 C:18 AB:0 BC:1 CA:1
-Smoothing: 18
-Face 35: A:17 B:22 C:23 AB:1 BC:1 CA:0
-Smoothing: 18
-Face 36: A:18 B:24 C:19 AB:0 BC:1 CA:1
-Smoothing: 19
-Face 37: A:18 B:23 C:24 AB:1 BC:1 CA:0
-Smoothing: 19
-
- Page 2
-
-
-
-Face 38: A:19 B:20 C:15 AB:0 BC:1 CA:1
-Smoothing: 20
-Face 39: A:19 B:24 C:20 AB:1 BC:1 CA:0
-Smoothing: 20
-Face 40: A:20 B:26 C:21 AB:0 BC:1 CA:1
-Smoothing: 21
-Face 41: A:20 B:25 C:26 AB:1 BC:1 CA:0
-Smoothing: 21
-Face 42: A:21 B:27 C:22 AB:0 BC:1 CA:1
-Smoothing: 22
-Face 43: A:21 B:26 C:27 AB:1 BC:1 CA:0
-Smoothing: 22
-Face 44: A:22 B:28 C:23 AB:0 BC:1 CA:1
-Smoothing: 23
-Face 45: A:22 B:27 C:28 AB:1 BC:1 CA:0
-Smoothing: 23
-Face 46: A:23 B:29 C:24 AB:0 BC:1 CA:1
-Smoothing: 24
-Face 47: A:23 B:28 C:29 AB:1 BC:1 CA:0
-Smoothing: 24
-Face 48: A:24 B:25 C:20 AB:0 BC:1 CA:1
-Smoothing: 25
-Face 49: A:24 B:29 C:25 AB:1 BC:1 CA:0
-Smoothing: 25
-Face 50: A:25 B:31 C:26 AB:0 BC:1 CA:1
-Smoothing: 26
-Face 51: A:25 B:30 C:31 AB:1 BC:1 CA:0
-Smoothing: 26
-Face 52: A:26 B:32 C:27 AB:0 BC:1 CA:1
-Smoothing: 27
-Face 53: A:26 B:31 C:32 AB:1 BC:1 CA:0
-Smoothing: 27
-Face 54: A:27 B:33 C:28 AB:0 BC:1 CA:1
-Smoothing: 28
-Face 55: A:27 B:32 C:33 AB:1 BC:1 CA:0
-Smoothing: 28
-Face 56: A:28 B:34 C:29 AB:0 BC:1 CA:1
-Smoothing: 29
-Face 57: A:28 B:33 C:34 AB:1 BC:1 CA:0
-Smoothing: 29
-Face 58: A:29 B:30 C:25 AB:0 BC:1 CA:1
-Smoothing: 30
-Face 59: A:29 B:34 C:30 AB:1 BC:1 CA:0
-Smoothing: 30
-Face 60: A:30 B:36 C:31 AB:0 BC:1 CA:1
-Smoothing: 31
-Face 61: A:30 B:35 C:36 AB:1 BC:1 CA:0
-Smoothing: 31
-Face 62: A:31 B:37 C:32 AB:0 BC:1 CA:1
-Smoothing: 32
-Face 63: A:31 B:36 C:37 AB:1 BC:1 CA:0
-Smoothing: 32
-Face 64: A:32 B:38 C:33 AB:0 BC:1 CA:1
-Smoothing: 1
-Face 65: A:32 B:37 C:38 AB:1 BC:1 CA:0
-Smoothing: 1
-Face 66: A:33 B:39 C:34 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 67: A:33 B:38 C:39 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 68: A:34 B:35 C:30 AB:0 BC:1 CA:1
-
- Page 3
-
-
-
-Smoothing: 3
-Face 69: A:34 B:39 C:35 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 70: A:35 B:1 C:36 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 71: A:35 B:0 C:1 AB:1 BC:1 CA:0
-Smoothing: 4
-Face 72: A:36 B:2 C:37 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 73: A:36 B:1 C:2 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 74: A:37 B:3 C:38 AB:0 BC:1 CA:1
-Smoothing: 6
-Face 75: A:37 B:2 C:3 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 76: A:38 B:4 C:39 AB:0 BC:1 CA:1
-Smoothing: 7
-Face 77: A:38 B:3 C:4 AB:1 BC:1 CA:0
-Smoothing: 7
-Face 78: A:39 B:0 C:35 AB:0 BC:1 CA:1
-Smoothing: 8
-Face 79: A:39 B:4 C:0 AB:1 BC:1 CA:0
-Smoothing: 8
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 4
-
-
-
diff --git a/progs/ggi/tube.asc b/progs/ggi/tube.asc
deleted file mode 100644
index 0b5dd0d810b..00000000000
--- a/progs/ggi/tube.asc
+++ /dev/null
@@ -1,396 +0,0 @@
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 64 Faces: 128
-Vertex list:
-Vertex 0: X: 61.483898 Y: 37.836231 Z: -70.94294
-Vertex 1: X: 82.867447 Y: 37.836235 Z: -41.288902
-Vertex 2: X: 91.275154 Y: 37.836239 Z: -5.70901
-Vertex 3: X: 85.427025 Y: 37.836243 Z: 30.380013
-Vertex 4: X: 66.213379 Y: 37.836243 Z: 61.483936
-Vertex 5: X: 36.559322 Y: 37.836246 Z: 82.86747
-Vertex 6: X: 0.979424 Y: 37.836246 Z: 91.275154
-Vertex 7: X: -35.109554 Y: 37.836246 Z: 85.42701
-Vertex 8: X: -66.213478 Y: 37.836246 Z: 66.213356
-Vertex 9: X: -87.597 Y: 37.836243 Z: 36.559303
-Vertex 10: X: -96.004677 Y: 37.836239 Z: 0.979406
-Vertex 11: X: -90.156517 Y: 37.836235 Z: -35.109615
-Vertex 12: X: -70.942848 Y: 37.836235 Z: -66.213516
-Vertex 13: X: -41.288776 Y: 37.836231 Z: -87.597023
-Vertex 14: X: -5.708872 Y: 37.836231 Z: -96.004692
-Vertex 15: X: 30.380142 Y: 37.836231 Z: -90.156502
-Vertex 16: X: 61.483898 Y: -38.14529 Z: -70.942932
-Vertex 17: X: 82.867447 Y: -38.145287 Z: -41.288895
-Vertex 18: X: 91.275154 Y: -38.145283 Z: -5.709003
-Vertex 19: X: 85.427025 Y: -38.145279 Z: 30.38002
-Vertex 20: X: 66.213379 Y: -38.145279 Z: 61.483944
-Vertex 21: X: 36.559322 Y: -38.145275 Z: 82.867477
-Vertex 22: X: 0.979424 Y: -38.145275 Z: 91.275162
-Vertex 23: X: -35.109554 Y: -38.145275 Z: 85.427017
-Vertex 24: X: -66.213478 Y: -38.145275 Z: 66.213364
-Vertex 25: X: -87.597 Y: -38.145279 Z: 36.559311
-Vertex 26: X: -96.004677 Y: -38.145283 Z: 0.979412
-Vertex 27: X: -90.156517 Y: -38.145287 Z: -35.109608
-Vertex 28: X: -70.942848 Y: -38.145287 Z: -66.213516
-Vertex 29: X: -41.288776 Y: -38.14529 Z: -87.597015
-Vertex 30: X: -5.708872 Y: -38.14529 Z: -96.004684
-Vertex 31: X: 30.380142 Y: -38.14529 Z: -90.156494
-Vertex 32: X: 29.53923 Y: 37.836235 Z: -36.632011
-Vertex 33: X: 40.224194 Y: 37.836239 Z: -21.814436
-Vertex 34: X: 44.425369 Y: 37.836239 Z: -4.035822
-Vertex 35: X: 41.503166 Y: 37.836239 Z: 13.997195
-Vertex 36: X: 31.902466 Y: 37.836243 Z: 29.539249
-Vertex 37: X: 17.084883 Y: 37.836243 Z: 40.224201
-Vertex 38: X: -0.693734 Y: 37.836243 Z: 44.425365
-Vertex 39: X: -18.726728 Y: 37.836243 Z: 41.503159
-Vertex 40: X: -34.26878 Y: 37.836243 Z: 31.902454
-Vertex 41: X: -44.953732 Y: 37.836239 Z: 17.084871
-Vertex 42: X: -49.154892 Y: 37.836239 Z: -0.693745
-Vertex 43: X: -46.232677 Y: 37.836239 Z: -18.726759
-Vertex 44: X: -36.631962 Y: 37.836235 Z: -34.268806
-Vertex 45: X: -21.814371 Y: 37.836235 Z: -44.953747
-Vertex 46: X: -4.035751 Y: 37.836235 Z: -49.1549
-Vertex 47: X: 13.997261 Y: 37.836235 Z: -46.23267
-Vertex 48: X: 29.53923 Y: -38.145287 Z: -36.632004
-Vertex 49: X: 40.224194 Y: -38.145283 Z: -21.814428
-Vertex 50: X: 44.425369 Y: -38.145283 Z: -4.035816
-Vertex 51: X: 41.503166 Y: -38.145283 Z: 13.997201
-Vertex 52: X: 31.902466 Y: -38.145279 Z: 29.539257
-Vertex 53: X: 17.084883 Y: -38.145279 Z: 40.224209
-Vertex 54: X: -0.693734 Y: -38.145279 Z: 44.425373
-Vertex 55: X: -18.726728 Y: -38.145279 Z: 41.503166
-
- Page 1
-
-
-
-Vertex 56: X: -34.26878 Y: -38.145279 Z: 31.902462
-Vertex 57: X: -44.953732 Y: -38.145283 Z: 17.084879
-Vertex 58: X: -49.154892 Y: -38.145283 Z: -0.693738
-Vertex 59: X: -46.232677 Y: -38.145283 Z: -18.726751
-Vertex 60: X: -36.631962 Y: -38.145287 Z: -34.268799
-Vertex 61: X: -21.814371 Y: -38.145287 Z: -44.953739
-Vertex 62: X: -4.035751 Y: -38.145287 Z: -49.154892
-Vertex 63: X: 13.997261 Y: -38.145287 Z: -46.232662
-Face list:
-Face 0: A:0 B:1 C:17 AB:1 BC:1 CA:0
-Smoothing: 1
-Face 1: A:0 B:17 C:16 AB:0 BC:1 CA:1
-Smoothing: 1
-Face 2: A:1 B:2 C:18 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 3: A:1 B:18 C:17 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 4: A:2 B:3 C:19 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 5: A:2 B:19 C:18 AB:0 BC:1 CA:1
-Smoothing: 3
-Face 6: A:3 B:4 C:20 AB:1 BC:1 CA:0
-Smoothing: 4
-Face 7: A:3 B:20 C:19 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 8: A:4 B:5 C:21 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 9: A:4 B:21 C:20 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 10: A:5 B:6 C:22 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 11: A:5 B:22 C:21 AB:0 BC:1 CA:1
-Smoothing: 6
-Face 12: A:6 B:7 C:23 AB:1 BC:1 CA:0
-Smoothing: 7
-Face 13: A:6 B:23 C:22 AB:0 BC:1 CA:1
-Smoothing: 7
-Face 14: A:7 B:8 C:24 AB:1 BC:1 CA:0
-Smoothing: 8
-Face 15: A:7 B:24 C:23 AB:0 BC:1 CA:1
-Smoothing: 8
-Face 16: A:8 B:9 C:25 AB:1 BC:1 CA:0
-Smoothing: 9
-Face 17: A:8 B:25 C:24 AB:0 BC:1 CA:1
-Smoothing: 9
-Face 18: A:9 B:10 C:26 AB:1 BC:1 CA:0
-Smoothing: 10
-Face 19: A:9 B:26 C:25 AB:0 BC:1 CA:1
-Smoothing: 10
-Face 20: A:10 B:11 C:27 AB:1 BC:1 CA:0
-Smoothing: 11
-Face 21: A:10 B:27 C:26 AB:0 BC:1 CA:1
-Smoothing: 11
-Face 22: A:11 B:12 C:28 AB:1 BC:1 CA:0
-Smoothing: 12
-Face 23: A:11 B:28 C:27 AB:0 BC:1 CA:1
-Smoothing: 12
-Face 24: A:12 B:13 C:29 AB:1 BC:1 CA:0
-Smoothing: 13
-Face 25: A:12 B:29 C:28 AB:0 BC:1 CA:1
-Smoothing: 13
-
- Page 2
-
-
-
-Face 26: A:13 B:14 C:30 AB:1 BC:1 CA:0
-Smoothing: 14
-Face 27: A:13 B:30 C:29 AB:0 BC:1 CA:1
-Smoothing: 14
-Face 28: A:14 B:15 C:31 AB:1 BC:1 CA:0
-Smoothing: 15
-Face 29: A:14 B:31 C:30 AB:0 BC:1 CA:1
-Smoothing: 15
-Face 30: A:15 B:0 C:16 AB:1 BC:1 CA:0
-Smoothing: 16
-Face 31: A:15 B:16 C:31 AB:0 BC:1 CA:1
-Smoothing: 16
-Face 32: A:32 B:49 C:33 AB:0 BC:1 CA:1
-Smoothing: 17
-Face 33: A:32 B:48 C:49 AB:1 BC:1 CA:0
-Smoothing: 17
-Face 34: A:33 B:50 C:34 AB:0 BC:1 CA:1
-Smoothing: 18
-Face 35: A:33 B:49 C:50 AB:1 BC:1 CA:0
-Smoothing: 18
-Face 36: A:34 B:51 C:35 AB:0 BC:1 CA:1
-Smoothing: 19
-Face 37: A:34 B:50 C:51 AB:1 BC:1 CA:0
-Smoothing: 19
-Face 38: A:35 B:52 C:36 AB:0 BC:1 CA:1
-Smoothing: 20
-Face 39: A:35 B:51 C:52 AB:1 BC:1 CA:0
-Smoothing: 20
-Face 40: A:36 B:53 C:37 AB:0 BC:1 CA:1
-Smoothing: 21
-Face 41: A:36 B:52 C:53 AB:1 BC:1 CA:0
-Smoothing: 21
-Face 42: A:37 B:54 C:38 AB:0 BC:1 CA:1
-Smoothing: 22
-Face 43: A:37 B:53 C:54 AB:1 BC:1 CA:0
-Smoothing: 22
-Face 44: A:38 B:55 C:39 AB:0 BC:1 CA:1
-Smoothing: 23
-Face 45: A:38 B:54 C:55 AB:1 BC:1 CA:0
-Smoothing: 23
-Face 46: A:39 B:56 C:40 AB:0 BC:1 CA:1
-Smoothing: 24
-Face 47: A:39 B:55 C:56 AB:1 BC:1 CA:0
-Smoothing: 24
-Face 48: A:40 B:57 C:41 AB:0 BC:1 CA:1
-Smoothing: 25
-Face 49: A:40 B:56 C:57 AB:1 BC:1 CA:0
-Smoothing: 25
-Face 50: A:41 B:58 C:42 AB:0 BC:1 CA:1
-Smoothing: 26
-Face 51: A:41 B:57 C:58 AB:1 BC:1 CA:0
-Smoothing: 26
-Face 52: A:42 B:59 C:43 AB:0 BC:1 CA:1
-Smoothing: 27
-Face 53: A:42 B:58 C:59 AB:1 BC:1 CA:0
-Smoothing: 27
-Face 54: A:43 B:60 C:44 AB:0 BC:1 CA:1
-Smoothing: 28
-Face 55: A:43 B:59 C:60 AB:1 BC:1 CA:0
-Smoothing: 28
-Face 56: A:44 B:61 C:45 AB:0 BC:1 CA:1
-
- Page 3
-
-
-
-Smoothing: 29
-Face 57: A:44 B:60 C:61 AB:1 BC:1 CA:0
-Smoothing: 29
-Face 58: A:45 B:62 C:46 AB:0 BC:1 CA:1
-Smoothing: 30
-Face 59: A:45 B:61 C:62 AB:1 BC:1 CA:0
-Smoothing: 30
-Face 60: A:46 B:63 C:47 AB:0 BC:1 CA:1
-Smoothing: 31
-Face 61: A:46 B:62 C:63 AB:1 BC:1 CA:0
-Smoothing: 31
-Face 62: A:47 B:48 C:32 AB:0 BC:1 CA:1
-Smoothing: 32
-Face 63: A:47 B:63 C:48 AB:1 BC:1 CA:0
-Smoothing: 32
-Face 64: A:0 B:32 C:33 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 65: A:0 B:33 C:1 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 66: A:1 B:33 C:34 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 67: A:1 B:34 C:2 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 68: A:2 B:34 C:35 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 69: A:2 B:35 C:3 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 70: A:3 B:35 C:36 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 71: A:3 B:36 C:4 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 72: A:4 B:36 C:37 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 73: A:4 B:37 C:5 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 74: A:5 B:37 C:38 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 75: A:5 B:38 C:6 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 76: A:6 B:38 C:39 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 77: A:6 B:39 C:7 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 78: A:7 B:39 C:40 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 79: A:7 B:40 C:8 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 80: A:8 B:40 C:41 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 81: A:8 B:41 C:9 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 82: A:9 B:41 C:42 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 83: A:9 B:42 C:10 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 84: A:10 B:42 C:43 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 85: A:10 B:43 C:11 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 86: A:11 B:43 C:44 AB:0 BC:1 CA:0
-Smoothing: 1
-
- Page 4
-
-
-
-Face 87: A:11 B:44 C:12 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 88: A:12 B:44 C:45 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 89: A:12 B:45 C:13 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 90: A:13 B:45 C:46 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 91: A:13 B:46 C:14 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 92: A:14 B:46 C:47 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 93: A:14 B:47 C:15 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 94: A:15 B:47 C:32 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 95: A:15 B:32 C:0 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 96: A:16 B:17 C:49 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 97: A:16 B:49 C:48 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 98: A:17 B:18 C:50 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 99: A:17 B:50 C:49 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 100: A:18 B:19 C:51 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 101: A:18 B:51 C:50 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 102: A:19 B:20 C:52 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 103: A:19 B:52 C:51 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 104: A:20 B:21 C:53 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 105: A:20 B:53 C:52 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 106: A:21 B:22 C:54 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 107: A:21 B:54 C:53 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 108: A:22 B:23 C:55 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 109: A:22 B:55 C:54 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 110: A:23 B:24 C:56 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 111: A:23 B:56 C:55 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 112: A:24 B:25 C:57 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 113: A:24 B:57 C:56 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 114: A:25 B:26 C:58 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 115: A:25 B:58 C:57 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 116: A:26 B:27 C:59 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 117: A:26 B:59 C:58 AB:0 BC:1 CA:0
-
- Page 5
-
-
-
-Smoothing: 2
-Face 118: A:27 B:28 C:60 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 119: A:27 B:60 C:59 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 120: A:28 B:29 C:61 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 121: A:28 B:61 C:60 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 122: A:29 B:30 C:62 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 123: A:29 B:62 C:61 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 124: A:30 B:31 C:63 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 125: A:30 B:63 C:62 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 126: A:31 B:16 C:48 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 127: A:31 B:48 C:63 AB:0 BC:1 CA:0
-Smoothing: 2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 6
-
-
-
diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile
index 8928c833c0e..3b5a5959aee 100644
--- a/progs/glsl/Makefile
+++ b/progs/glsl/Makefile
@@ -69,6 +69,9 @@ $(PROG_OBJS): $(UTIL_HEADERS)
$(PROGS): $(UTIL_OBJS)
+.o:
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
clean:
-rm -f $(PROGS)
-rm -f *.o *~
diff --git a/progs/miniglx/.gitignore b/progs/miniglx/.gitignore
deleted file mode 100644
index f630f591f62..00000000000
--- a/progs/miniglx/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-manytex
-miniglxsample
-miniglxtest
-sample_server
-sample_server2
-texline
diff --git a/progs/miniglx/Makefile b/progs/miniglx/Makefile
deleted file mode 100644
index e6f5fa558e9..00000000000
--- a/progs/miniglx/Makefile
+++ /dev/null
@@ -1,61 +0,0 @@
-# Makefile for miniglx demo programs
-
-TOP = ../..
-
-include $(TOP)/configs/current
-
-
-SOURCES = miniglxtest.c \
- miniglxsample.c \
- sample_server.c \
- sample_server2.c \
- manytex.c \
- texline.c
-
-OBJECTS = $(SOURCES:.c=.o)
-
-PROGS = $(SOURCES:%.c=%)
-
-INCLUDES = \
- -I. \
- -I$(TOP)/include
-
-LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
-
-
-##### RULES #####
-
-.SUFFIXES:
-.SUFFIXES: .c
-
-.c:
- $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
-
-
-##### TARGETS #####
-
-default: depend $(PROGS)
-
-clean:
- -rm -f $(PROGS)
- -rm -f *.o
-
-
-depend: $(SOURCES)
- rm -f depend
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null
-
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` `find ../include`
-
-
-include depend
diff --git a/progs/miniglx/glfbdevtest.c b/progs/miniglx/glfbdevtest.c
deleted file mode 100644
index d4efb96930b..00000000000
--- a/progs/miniglx/glfbdevtest.c
+++ /dev/null
@@ -1,477 +0,0 @@
-
-/*
- * Test the GLFBDev interface. Only tested with radeonfb driver!!!!
- */
-
-
-#include <assert.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <linux/fb.h>
-#include <linux/kd.h>
-#include <linux/vt.h>
-#include <GL/glut.h>
-#include "GL/glfbdev.h"
-
-#define DEFAULT_DEPTH 8
-
-static struct fb_fix_screeninfo FixedInfo;
-static struct fb_var_screeninfo VarInfo, OrigVarInfo;
-static int DesiredDepth = 0;
-static int OriginalVT = -1;
-static int ConsoleFD = -1;
-static int FrameBufferFD = -1;
-static caddr_t FrameBuffer = (caddr_t) -1;
-static caddr_t MMIOAddress = (caddr_t) -1;
-
-
-static void
-print_fixed_info(const struct fb_fix_screeninfo *fixed, const char *s)
-{
- static const char *visuals[] = {
- "MONO01", "MONO10", "TRUECOLOR", "PSEUDOCOLOR",
- "DIRECTCOLOR", "STATIC_PSEUDOCOLOR"
- };
-
- printf("%s info -----------------------\n", s);
- printf("id = %16s\n", fixed->id);
- printf("smem_start = 0x%x\n", fixed->smem_start);
- printf("smem_len = %d (0x%x)\n", fixed->smem_len, fixed->smem_len);
- printf("type = 0x%x\n", fixed->type);
- printf("type_aux = 0x%x\n", fixed->type_aux);
- printf("visual = 0x%x (%s)\n", fixed->visual, visuals[fixed->visual]);
- printf("xpanstep = %d\n", fixed->xpanstep);
- printf("ypanstep = %d\n", fixed->ypanstep);
- printf("ywrapstep = %d\n", fixed->ywrapstep);
- printf("line_length = %d\n", fixed->line_length);
- printf("mmio_start = 0x%x\n", fixed->mmio_start);
- printf("mmio_len = %d (0x%x)\n", fixed->mmio_len, fixed->mmio_len);
- printf("accel = 0x%x\n", fixed->accel);
-}
-
-
-static void
-print_var_info(const struct fb_var_screeninfo *var, const char *s)
-{
- printf("%s info -----------------------\n", s);
- printf("xres = %d\n", var->xres);
- printf("yres = %d\n", var->yres);
- printf("xres_virtual = %d\n", var->xres_virtual);
- printf("yres_virtual = %d\n", var->yres_virtual);
- printf("xoffset = %d\n", var->xoffset);
- printf("yoffset = %d\n", var->yoffset);
- printf("bits_per_pixel = %d\n", var->bits_per_pixel);
- printf("grayscale = %d\n", var->grayscale);
-
- printf("red.offset = %d length = %d msb_right = %d\n",
- var->red.offset, var->red.length, var->red.msb_right);
- printf("green.offset = %d length = %d msb_right = %d\n",
- var->green.offset, var->green.length, var->green.msb_right);
- printf("blue.offset = %d length = %d msb_right = %d\n",
- var->blue.offset, var->blue.length, var->blue.msb_right);
- printf("transp.offset = %d length = %d msb_right = %d\n",
- var->transp.offset, var->transp.length, var->transp.msb_right);
-
- printf("nonstd = %d\n", var->nonstd);
- printf("activate = %d\n", var->activate);
- printf("height = %d mm\n", var->height);
- printf("width = %d mm\n", var->width);
- printf("accel_flags = 0x%x\n", var->accel_flags);
- printf("pixclock = %d\n", var->pixclock);
- printf("left_margin = %d\n", var->left_margin);
- printf("right_margin = %d\n", var->right_margin);
- printf("upper_margin = %d\n", var->upper_margin);
- printf("lower_margin = %d\n", var->lower_margin);
- printf("hsync_len = %d\n", var->hsync_len);
- printf("vsync_len = %d\n", var->vsync_len);
- printf("sync = %d\n", var->sync);
- printf("vmode = %d\n", var->vmode);
-}
-
-
-static void
-signal_handler(int signumber)
-{
- signal(signumber, SIG_IGN); /* prevent recursion! */
- fprintf(stderr, "error: got signal %d (exiting)\n", signumber);
- exit(1);
-}
-
-
-static void
-initialize_fbdev( void )
-{
- char ttystr[1000];
- int fd, vtnumber, ttyfd;
- int sz;
-
- if (geteuid()) {
- fprintf(stderr, "error: you need to be root\n");
- exit(1);
- }
-
-#if 1
- /* open the framebuffer device */
- FrameBufferFD = open("/dev/fb0", O_RDWR);
- if (FrameBufferFD < 0) {
- fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno));
- exit(1);
- }
-#endif
-
- /* open /dev/tty0 and get the vt number */
- if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) {
- fprintf(stderr, "error opening /dev/tty0\n");
- exit(1);
- }
- if (ioctl(fd, VT_OPENQRY, &vtnumber) < 0 || vtnumber < 0) {
- fprintf(stderr, "error: couldn't get a free vt\n");
- exit(1);
- }
- close(fd);
-
- /* open the console tty */
- sprintf(ttystr, "/dev/tty%d", vtnumber); /* /dev/tty1-64 */
- ConsoleFD = open(ttystr, O_RDWR | O_NDELAY, 0);
- if (ConsoleFD < 0) {
- fprintf(stderr, "error couldn't open console fd\n");
- exit(1);
- }
-
- /* save current vt number */
- {
- struct vt_stat vts;
- if (ioctl(ConsoleFD, VT_GETSTATE, &vts) == 0)
- OriginalVT = vts.v_active;
- }
-
- /* disconnect from controlling tty */
- ttyfd = open("/dev/tty", O_RDWR);
- if (ttyfd >= 0) {
- ioctl(ttyfd, TIOCNOTTY, 0);
- close(ttyfd);
- }
-
- /* some magic to restore the vt when we exit */
- {
- struct vt_mode vt;
- if (ioctl(ConsoleFD, VT_ACTIVATE, vtnumber) != 0)
- printf("ioctl VT_ACTIVATE: %s\n", strerror(errno));
- if (ioctl(ConsoleFD, VT_WAITACTIVE, vtnumber) != 0)
- printf("ioctl VT_WAITACTIVE: %s\n", strerror(errno));
-
- if (ioctl(ConsoleFD, VT_GETMODE, &vt) < 0) {
- fprintf(stderr, "error: ioctl VT_GETMODE: %s\n", strerror(errno));
- exit(1);
- }
-
- vt.mode = VT_PROCESS;
- vt.relsig = SIGUSR1;
- vt.acqsig = SIGUSR1;
- if (ioctl(ConsoleFD, VT_SETMODE, &vt) < 0) {
- fprintf(stderr, "error: ioctl(VT_SETMODE) failed: %s\n",
- strerror(errno));
- exit(1);
- }
- }
-
- /* go into graphics mode */
- if (ioctl(ConsoleFD, KDSETMODE, KD_GRAPHICS) < 0) {
- fprintf(stderr, "error: ioctl(KDSETMODE, KD_GRAPHICS) failed: %s\n",
- strerror(errno));
- exit(1);
- }
-
-
-#if 0
- /* open the framebuffer device */
- FrameBufferFD = open("/dev/fb0", O_RDWR);
- if (FrameBufferFD < 0) {
- fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno));
- exit(1);
- }
-#endif
-
- /* Get the fixed screen info */
- if (ioctl(FrameBufferFD, FBIOGET_FSCREENINFO, &FixedInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n",
- strerror(errno));
- exit(1);
- }
-
- print_fixed_info(&FixedInfo, "Fixed");
-
-
- /* get the variable screen info */
- if (ioctl(FrameBufferFD, FBIOGET_VSCREENINFO, &OrigVarInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n",
- strerror(errno));
- exit(1);
- }
-
- print_var_info(&OrigVarInfo, "Orig Var");
-
- /* operate on a copy */
- VarInfo = OrigVarInfo;
-
- /* set the depth, resolution, etc */
- DesiredDepth = 32;
- if (DesiredDepth)
- VarInfo.bits_per_pixel = DesiredDepth;
-
- if (VarInfo.bits_per_pixel == 16) {
- VarInfo.red.offset = 11;
- VarInfo.green.offset = 5;
- VarInfo.blue.offset = 0;
- VarInfo.red.length = 5;
- VarInfo.green.length = 6;
- VarInfo.blue.length = 5;
- VarInfo.transp.offset = 0;
- VarInfo.transp.length = 0;
- }
- else if (VarInfo.bits_per_pixel == 32) {
- VarInfo.red.offset = 16;
- VarInfo.green.offset = 8;
- VarInfo.blue.offset = 0;
- VarInfo.transp.offset = 24;
- VarInfo.red.length = 8;
- VarInfo.green.length = 8;
- VarInfo.blue.length = 8;
- VarInfo.transp.length = 8;
- }
- /* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */
- VarInfo.xres_virtual = VarInfo.xres = 1280;
- VarInfo.yres_virtual = VarInfo.yres = 1024;
- VarInfo.pixclock = 7408;
- VarInfo.left_margin = 248;
- VarInfo.right_margin = 16;
- VarInfo.upper_margin = 38;
- VarInfo.lower_margin = 1;
- VarInfo.hsync_len = 144;
- VarInfo.vsync_len = 3;
-
- VarInfo.xoffset = 0;
- VarInfo.yoffset = 0;
- VarInfo.nonstd = 0;
- VarInfo.vmode &= ~FB_VMODE_YWRAP; /* turn off scrolling */
-
- /* set new variable screen info */
- if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &VarInfo)) {
- fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n",
- strerror(errno));
- exit(1);
- }
-
- print_var_info(&VarInfo, "New Var");
-
- if (FixedInfo.visual != FB_VISUAL_TRUECOLOR &&
- FixedInfo.visual != FB_VISUAL_DIRECTCOLOR) {
- fprintf(stderr, "non-TRUE/DIRECT-COLOR visuals (0x%x) not supported by this demo.\n", FixedInfo.visual);
- exit(1);
- }
-
- /* initialize colormap */
- if (FixedInfo.visual == FB_VISUAL_DIRECTCOLOR) {
- struct fb_cmap cmap;
- unsigned short red[256], green[256], blue[256];
- int i;
-
- /* we're assuming 256 entries here */
- printf("initializing directcolor colormap\n");
- cmap.start = 0;
- cmap.len = 256;
- cmap.red = red;
- cmap.green = green;
- cmap.blue = blue;
- cmap.transp = NULL;
- for (i = 0; i < cmap.len; i++) {
- red[i] = green[i] = blue[i] = (i << 8) | i;
- }
- if (ioctl(FrameBufferFD, FBIOPUTCMAP, (void *) &cmap) < 0) {
- fprintf(stderr, "ioctl(FBIOPUTCMAP) failed [%d]\n", i);
- }
- }
-
- /*
- * fbdev says the frame buffer is at offset zero, and the mmio region
- * is immediately after.
- */
-
- /* mmap the framebuffer into our address space */
- FrameBuffer = (caddr_t) mmap(0, /* start */
- FixedInfo.smem_len, /* bytes */
- PROT_READ | PROT_WRITE, /* prot */
- MAP_SHARED, /* flags */
- FrameBufferFD, /* fd */
- 0 /* offset */);
- if (FrameBuffer == (caddr_t) - 1) {
- fprintf(stderr, "error: unable to mmap framebuffer: %s\n",
- strerror(errno));
- exit(1);
- }
- printf("FrameBuffer = %p\n", FrameBuffer);
-
-#if 1
- /* mmap the MMIO region into our address space */
- MMIOAddress = (caddr_t) mmap(0, /* start */
- FixedInfo.mmio_len, /* bytes */
- PROT_READ | PROT_WRITE, /* prot */
- MAP_SHARED, /* flags */
- FrameBufferFD, /* fd */
- FixedInfo.smem_len /* offset */);
- if (MMIOAddress == (caddr_t) - 1) {
- fprintf(stderr, "error: unable to mmap mmio region: %s\n",
- strerror(errno));
- }
- printf("MMIOAddress = %p\n", MMIOAddress);
-
- /* try out some simple MMIO register reads */
- if (1)
- {
- typedef unsigned int CARD32;
- typedef unsigned char CARD8;
-#define RADEON_CONFIG_MEMSIZE 0x00f8
-#define RADEON_MEM_SDRAM_MODE_REG 0x0158
-#define MMIO_IN32(base, offset) \
- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
-#define INREG(addr) MMIO_IN32(MMIOAddress, addr)
- int sz, type;
- const char *typeStr[] = {"SDR", "DDR", "64-bit SDR"};
- sz = INREG(RADEON_CONFIG_MEMSIZE);
- type = INREG(RADEON_MEM_SDRAM_MODE_REG);
- printf("RADEON_CONFIG_MEMSIZE = %d (%d MB)\n", sz, sz / 1024 / 1024);
- printf("RADEON_MEM_SDRAM_MODE_REG >> 30 = %d (%s)\n",
- type >> 30, typeStr[type>>30]);
- }
-#endif
-
-}
-
-
-static void
-shutdown_fbdev( void )
-{
- struct vt_mode VT;
-
- printf("cleaning up...\n");
- /* restore original variable screen info */
- if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &OrigVarInfo)) {
- fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n",
- strerror(errno));
- exit(1);
- }
-
- munmap(MMIOAddress, FixedInfo.mmio_len);
- munmap(FrameBuffer, FixedInfo.smem_len);
- close(FrameBufferFD);
-
- /* restore text mode */
- ioctl(ConsoleFD, KDSETMODE, KD_TEXT);
-
- /* set vt */
- if (ioctl(ConsoleFD, VT_GETMODE, &VT) != -1) {
- VT.mode = VT_AUTO;
- ioctl(ConsoleFD, VT_SETMODE, &VT);
- }
-
- /* restore original vt */
- if (OriginalVT >= 0) {
- ioctl(ConsoleFD, VT_ACTIVATE, OriginalVT);
- OriginalVT = -1;
- }
-
- close(ConsoleFD);
-}
-
-
-static void
-gltest( void )
-{
- static const int attribs[] = {
- GLFBDEV_DOUBLE_BUFFER,
- GLFBDEV_DEPTH_SIZE, 16,
- GLFBDEV_NONE
- };
- GLFBDevContextPtr ctx;
- GLFBDevBufferPtr buf;
- GLFBDevVisualPtr vis;
- int bytes, r, g, b, a;
- float ang;
-
- printf("GLFBDEV_VENDOR = %s\n", glFBDevGetString(GLFBDEV_VENDOR));
- printf("GLFBDEV_VERSION = %s\n", glFBDevGetString(GLFBDEV_VERSION));
-
- /* framebuffer size */
- bytes = VarInfo.xres_virtual * VarInfo.yres_virtual * VarInfo.bits_per_pixel / 8;
-
- vis = glFBDevCreateVisual( &FixedInfo, &VarInfo, attribs );
- assert(vis);
-
- buf = glFBDevCreateBuffer( &FixedInfo, &VarInfo, vis, FrameBuffer, NULL, bytes );
- assert(buf);
-
- ctx = glFBDevCreateContext( vis, NULL );
- assert(buf);
-
- b = glFBDevMakeCurrent( ctx, buf, buf );
- assert(b);
-
- /*printf("GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));*/
- glGetIntegerv(GL_RED_BITS, &r);
- glGetIntegerv(GL_GREEN_BITS, &g);
- glGetIntegerv(GL_BLUE_BITS, &b);
- glGetIntegerv(GL_ALPHA_BITS, &a);
- printf("RED_BITS=%d GREEN_BITS=%d BLUE_BITS=%d ALPHA_BITS=%d\n",
- r, g, b, a);
-
- glClearColor(0.5, 0.5, 1.0, 0);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1, 1, -1, 1, 2, 30);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0, 0, -15);
- glViewport(0, 0, VarInfo.xres_virtual, VarInfo.yres_virtual);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- for (ang = 0; ang <= 180; ang += 15) {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glPushMatrix();
- glRotatef(ang, 1, 0, 0);
- glutSolidTorus(1, 3, 40, 20);
- glPopMatrix();
- glFBDevSwapBuffers(buf);
- }
-
- /* clean up */
- b = glFBDevMakeCurrent( NULL, NULL, NULL);
- assert(b);
-
- glFBDevDestroyContext(ctx);
- glFBDevDestroyBuffer(buf);
- glFBDevDestroyVisual(vis);
-}
-
-
-int
-main( int argc, char *argv[] )
-{
- signal(SIGUSR1, signal_handler); /* exit if someone tries a vt switch */
- signal(SIGSEGV, signal_handler); /* catch segfaults */
-
- initialize_fbdev();
- gltest();
- shutdown_fbdev();
-
- return 0;
-}
diff --git a/progs/miniglx/manytex.c b/progs/miniglx/manytex.c
deleted file mode 100644
index 74b06649f6e..00000000000
--- a/progs/miniglx/manytex.c
+++ /dev/null
@@ -1,381 +0,0 @@
-
-/*
- * test handling of many texture maps
- * Also tests texture priority and residency.
- *
- * Brian Paul
- * August 2, 2000
- */
-
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <GL/glut.h>
-
-
-static GLint NumTextures = 20;
-static GLuint *TextureID = NULL;
-static GLint *TextureWidth = NULL, *TextureHeight = NULL;
-static GLboolean *TextureResidency = NULL;
-static GLint TexWidth = 128, TexHeight = 128;
-static GLfloat Zrot = 0;
-static GLboolean Anim = GL_TRUE;
-static GLint WinWidth = 500, WinHeight = 400;
-static GLboolean MipMap = GL_FALSE;
-static GLboolean LinearFilter = GL_FALSE;
-static GLboolean RandomSize = GL_FALSE;
-static GLint Rows, Columns;
-static GLint LowPriorityCount = 0;
-
-
-static void Idle( void )
-{
- Zrot += 1.0;
- glutPostRedisplay();
-}
-
-
-static void Display( void )
-{
- GLfloat spacing = WinWidth / Columns;
- GLfloat size = spacing * 0.4;
- GLint i;
-
- /* test residency */
- if (0)
- {
- GLboolean b;
- GLint i, resident;
- b = glAreTexturesResident(NumTextures, TextureID, TextureResidency);
- if (b) {
- printf("all resident\n");
- }
- else {
- resident = 0;
- for (i = 0; i < NumTextures; i++) {
- if (TextureResidency[i]) {
- resident++;
- }
- }
- printf("%d of %d texture resident\n", resident, NumTextures);
- }
- }
-
- /* render the textured quads */
- glClear( GL_COLOR_BUFFER_BIT );
- for (i = 0; i < NumTextures; i++) {
- GLint row = i / Columns;
- GLint col = i % Columns;
- GLfloat x = col * spacing + spacing * 0.5;
- GLfloat y = row * spacing + spacing * 0.5;
-
- GLfloat maxDim = (TextureWidth[i] > TextureHeight[i])
- ? TextureWidth[i] : TextureHeight[i];
- GLfloat w = TextureWidth[i] / maxDim;
- GLfloat h = TextureHeight[i] / maxDim;
-
- glPushMatrix();
- glTranslatef(x, y, 0.0);
- glRotatef(Zrot, 0, 0, 1);
- glScalef(size, size, 1);
-
- glBindTexture(GL_TEXTURE_2D, TextureID[i]);
- glBegin(GL_POLYGON);
-#if 0
- glTexCoord2f(0, 0); glVertex2f(-1, -1);
- glTexCoord2f(1, 0); glVertex2f( 1, -1);
- glTexCoord2f(1, 1); glVertex2f( 1, 1);
- glTexCoord2f(0, 1); glVertex2f(-1, 1);
-#else
- glTexCoord2f(0, 0); glVertex2f(-w, -h);
- glTexCoord2f(1, 0); glVertex2f( w, -h);
- glTexCoord2f(1, 1); glVertex2f( w, h);
- glTexCoord2f(0, 1); glVertex2f(-w, h);
-#endif
- glEnd();
- glPopMatrix();
- }
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- WinWidth = width;
- WinHeight = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho(0, width, 0, height, -1, 1);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-}
-
-
-/*
- * Return a random int in [min, max].
- */
-static int RandomInt(int min, int max)
-{
- int i = rand();
- int j = i % (max - min + 1);
- return min + j;
-}
-
-
-
-static void Init( void )
-{
- GLint i;
-
- if (RandomSize) {
- printf("Creating %d %s random-size textures, ", NumTextures,
- MipMap ? "Mipmapped" : "non-Mipmapped");
- }
- else {
- printf("Creating %d %s %d x %d textures, ", NumTextures,
- MipMap ? "Mipmapped" : "non-Mipmapped",
- TexWidth, TexHeight);
- }
-
- if (LinearFilter) {
- printf("bilinear filtering\n");
- }
- else {
- printf("nearest filtering\n");
- }
-
-
- /* compute number of rows and columns of rects */
- {
- GLfloat area = (GLfloat) (WinWidth * WinHeight) / (GLfloat) NumTextures;
- GLfloat edgeLen = sqrt(area);
-
- Columns = WinWidth / edgeLen;
- Rows = (NumTextures + Columns - 1) / Columns;
- printf("Rows: %d Cols: %d\n", Rows, Columns);
- }
-
-
- if (!TextureID) {
- TextureID = (GLuint *) malloc(sizeof(GLuint) * NumTextures);
- assert(TextureID);
- glGenTextures(NumTextures, TextureID);
- }
-
- if (!TextureResidency) {
- TextureResidency = (GLboolean *) malloc(sizeof(GLboolean) * NumTextures);
- assert(TextureResidency);
- }
-
- if (!TextureWidth) {
- TextureWidth = (GLint *) malloc(sizeof(GLint) * NumTextures);
- assert(TextureWidth);
- }
- if (!TextureHeight) {
- TextureHeight = (GLint *) malloc(sizeof(GLint) * NumTextures);
- assert(TextureHeight);
- }
-
- for (i = 0; i < NumTextures; i++) {
- GLubyte color[4];
- GLubyte *texImage;
- GLint j, row, col;
-
- row = i / Columns;
- col = i % Columns;
-
- glBindTexture(GL_TEXTURE_2D, TextureID[i]);
-
- if (i < LowPriorityCount)
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, 0.5F);
-
- if (RandomSize) {
-#if 0
- int k = (glutGet(GLUT_ELAPSED_TIME) % 7) + 2;
- TexWidth = 1 << k;
- TexHeight = 1 << k;
-#else
- TexWidth = 1 << RandomInt(2, 7);
- TexHeight = 1 << RandomInt(2, 7);
- printf("Random size of %3d: %d x %d\n", i, TexWidth, TexHeight);
-#endif
- }
-
- TextureWidth[i] = TexWidth;
- TextureHeight[i] = TexHeight;
-
- texImage = (GLubyte*) malloc(4 * TexWidth * TexHeight * sizeof(GLubyte));
- assert(texImage);
-
- /* determine texture color */
- color[0] = (GLint) (255.0 * ((float) col / (Columns - 1)));
- color[1] = 127;
- color[2] = (GLint) (255.0 * ((float) row / (Rows - 1)));
- color[3] = 255;
-
- /* fill in solid-colored teximage */
- for (j = 0; j < TexWidth * TexHeight; j++) {
- texImage[j*4+0] = color[0];
- texImage[j*4+1] = color[1];
- texImage[j*4+2] = color[2];
- texImage[j*4+3] = color[3];
- }
-
- if (MipMap) {
- GLint level = 0;
- GLint w = TexWidth, h = TexHeight;
- while (1) {
- glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, w, h, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, texImage);
- if (w == 1 && h == 1)
- break;
- if (w > 1)
- w /= 2;
- if (h > 1)
- h /= 2;
- level++;
- /*printf("%d: %d x %d\n", level, w, h);*/
- }
- if (LinearFilter) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR_MIPMAP_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- else {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_NEAREST_MIPMAP_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
- }
- else {
- /* Set corners to white */
- int k = 0;
- texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255;
- k = (TexWidth - 1) * 4;
- texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255;
- k = (TexWidth * TexHeight - TexWidth) * 4;
- texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255;
- k = (TexWidth * TexHeight - 1) * 4;
- texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255;
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, texImage);
- if (LinearFilter) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- else {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
- }
-
- free(texImage);
- }
-
- glEnable(GL_TEXTURE_2D);
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 's':
- Idle();
- break;
- case 'z':
- Zrot -= step;
- break;
- case 'Z':
- Zrot += step;
- break;
- case ' ':
- Init();
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-int main( int argc, char *argv[] )
-{
- GLint i;
-
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( WinWidth, WinHeight );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- if (Anim)
- glutIdleFunc(Idle);
-
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-n") == 0) {
- NumTextures = atoi(argv[i+1]);
- if (NumTextures <= 0) {
- printf("Error, bad number of textures\n");
- return 1;
- }
- i++;
- }
- else if (strcmp(argv[i], "-mipmap") == 0) {
- MipMap = GL_TRUE;
- }
- else if (strcmp(argv[i], "-linear") == 0) {
- LinearFilter = GL_TRUE;
- }
- else if (strcmp(argv[i], "-size") == 0) {
- TexWidth = atoi(argv[i+1]);
- TexHeight = atoi(argv[i+2]);
- assert(TexWidth >= 1);
- assert(TexHeight >= 1);
- i += 2;
- }
- else if (strcmp(argv[i], "-randomsize") == 0) {
- RandomSize = GL_TRUE;
- }
- else if (strcmp(argv[i], "-lowpri") == 0) {
- LowPriorityCount = atoi(argv[i+1]);
- i++;
- }
- else {
- printf("Usage:\n");
- printf(" manytex [options]\n");
- printf("Options:\n");
- printf(" -n <number of texture objects>\n");
- printf(" -size <width> <height> - specify texture size\n");
- printf(" -randomsize - use random size textures\n");
- printf(" -mipmap - generate mipmaps\n");
- printf(" -linear - use linear filtering instead of nearest\n");
- printf(" -lowpri <n> - Set lower priority on <n> textures\n");
- return 0;
- }
- }
-
- Init();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/progs/miniglx/miniglxsample.c b/progs/miniglx/miniglxsample.c
deleted file mode 100644
index d4d6729f932..00000000000
--- a/progs/miniglx/miniglxsample.c
+++ /dev/null
@@ -1,128 +0,0 @@
-
-#define USE_MINIGLX 1 /* 1 = use Mini GLX, 0 = use Xlib/GLX */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <GL/gl.h>
-
-#if USE_MINIGLX
-#include <GL/miniglx.h>
-#else
-#include <GL/glx.h>
-#include <X11/Xlib.h>
-#endif
-
-static void _subset_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
-{
- glBegin( GL_QUADS );
- glVertex2f( x1, y1 );
- glVertex2f( x2, y1 );
- glVertex2f( x2, y2 );
- glVertex2f( x1, y2 );
- glEnd();
-}
-
-
-/*
- * Create a simple double-buffered RGBA window.
- */
-static Window
-MakeWindow(Display * dpy, unsigned int width, unsigned int height)
-{
- int visAttributes[] = {
- GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DOUBLEBUFFER,
- None
- };
- XSetWindowAttributes attr;
- unsigned long attrMask;
- Window root;
- Window win;
- GLXContext ctx;
- XVisualInfo *visinfo;
-
- root = RootWindow(dpy, 0);
-
- /* Choose GLX visual / pixel format */
- visinfo = glXChooseVisual(dpy, 0, visAttributes);
- if (!visinfo) {
- printf("Error: couldn't get an RGB, Double-buffered visual\n");
- exit(1);
- }
-
- /* Create the window */
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
- attrMask = CWBackPixel | CWBorderPixel | CWColormap;
- win = XCreateWindow(dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, attrMask, &attr);
- if (!win) {
- printf("Error: XCreateWindow failed\n");
- exit(1);
- }
-
- /* Display the window */
- XMapWindow(dpy, win);
-
- /* Create GLX rendering context */
- ctx = glXCreateContext(dpy, visinfo, NULL, True);
- if (!ctx) {
- printf("Error: glXCreateContext failed\n");
- exit(1);
- }
-
- /* Bind the rendering context and window */
- glXMakeCurrent(dpy, win, ctx);
-
- glViewport(0, 0, width, height);
-
- return win;
-}
-
-
-/*
- * Draw a few frames of a rotating square.
- */
-static void
-DrawFrames(Display * dpy, Window win)
-{
- int angle;
- glShadeModel(GL_FLAT);
- glClearColor(0.5, 0.5, 0.5, 1.0);
- for (angle = 0; angle < 360; angle += 10) {
- glClear(GL_COLOR_BUFFER_BIT);
- glColor3f(1.0, 1.0, 0.0);
- glPushMatrix();
- glRotatef(angle, 0, 0, 1);
- _subset_Rectf(-0.8, -0.8, 0.8, 0.8);
- glPopMatrix();
- glXSwapBuffers(dpy, win);
- sleep(1);
- }
-}
-
-
-int
-main(int argc, char *argv[])
-{
- Display *dpy;
- Window win;
-
- dpy = XOpenDisplay(NULL);
- if (!dpy) {
- printf("Error: XOpenDisplay failed\n");
- return 1;
- }
-
- win = MakeWindow(dpy, 300, 300);
-
- DrawFrames(dpy, win);
-
- return 0;
-}
diff --git a/progs/miniglx/miniglxtest.c b/progs/miniglx/miniglxtest.c
deleted file mode 100644
index 85c25be4ed5..00000000000
--- a/progs/miniglx/miniglxtest.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Test the mini GLX interface.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <GL/gl.h>
-#define USE_MINI_GLX 1
-#if USE_MINI_GLX
-#include <GL/miniglx.h>
-#else
-#include <GL/glx.h>
-#endif
-
-static GLXContext ctx;
-
-static GLuint NumFrames = 100;
-static GLuint NumDisplays = 1;
-static GLboolean Texture = GL_FALSE;
-static GLboolean SingleBuffer = GL_FALSE;
-static GLboolean Sleeps = GL_TRUE;
-
-
-static void
-rect(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- glBegin(GL_QUADS);
- glTexCoord2f(0, 0); glColor3f(0, 0, 1); glVertex2f(x1, y1);
- glTexCoord2f(1, 0); glColor3f(1, 0, 0); glVertex2f(x2, y1);
- glTexCoord2f(1, 1); glColor3f(0, 1, 0); glVertex2f(x2, y2);
- glTexCoord2f(0, 1); glColor3f(0, 0, 0); glVertex2f(x1, y2);
- glEnd();
-}
-
-
-static void
-redraw(Display *dpy, Window w, int rot)
-{
- GLfloat a;
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix();
- glRotatef(rot, 0, 0, 1);
- glScalef(.5, .5, .5);
- for (a = 0.0; a < 360.0; a += 30.0) {
- glPushMatrix();
- glRotatef(a, 0, 0, 1);
- glRotatef(40, 1, 0, 0);
- glColor3f(a / 360.0, 1-a/360.0, 0);
- rect(0.3, -0.25, 1.5, 0.25);
- glPopMatrix();
- }
- glPopMatrix();
-
- if (SingleBuffer)
- glFlush();
- else
- glXSwapBuffers(dpy, w);
-}
-
-
-static Window
-make_window(Display *dpy, unsigned int width, unsigned int height)
-{
- int attrib_single[] = { GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DEPTH_SIZE, 1,
- None };
- int attrib_double[] = { GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DEPTH_SIZE, 1,
- GLX_DOUBLEBUFFER,
- None };
- int *attrib = SingleBuffer ? attrib_single : attrib_double;
- int scrnum = 0;
- XSetWindowAttributes attr;
- unsigned long mask;
- Window root;
- Window win;
- XVisualInfo *visinfo;
-
- root = RootWindow(dpy, scrnum);
-
- if (!(visinfo = glXChooseVisual(dpy, scrnum, attrib))) {
- printf("Error: couldn't get an RGB, Double-buffered visual\n");
- exit(1);
- }
-
- if (!(ctx = glXCreateContext(dpy, visinfo, NULL, True))) {
- printf("Error: glXCreateContext failed\n");
- exit(1);
- }
-
- /* window attributes */
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask;
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow(dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr);
- if (!win) {
- printf("Error: XCreateWindow failed\n");
- exit(1);
- }
-
- glXMakeCurrent(dpy, win, ctx);
-
- glViewport(0, 0, width, height);
-
- return win;
-}
-
-
-static void
-event_loop(Display *dpy, Window win)
-{
- int i;
-
- printf("Drawing %d frames\n", NumFrames);
-
- for (i = 0; i < NumFrames; i++) {
- redraw(dpy, win, -i*2);
- if (Sleeps) {
- usleep(20000);
- }
- }
-}
-
-
-static int
-runtest(void)
-{
- Display *dpy;
- Window win;
-
- dpy = XOpenDisplay(NULL);
- if (!dpy) {
- printf("Error: XOpenDisplay failed\n");
- return 1;
- }
-
- win = make_window(dpy, 800, 600);
-
- srand(getpid());
-
- /* init GL state */
- glClearColor(0.5, 0.5, 0.5, 1.0);
- glEnable(GL_DEPTH_TEST);
- if (Texture) {
- GLubyte image[16][16][4];
- GLint i, j;
- for (i = 0; i < 16; i++) {
- for (j = 0; j < 16; j++) {
- if (((i / 2) ^ (j / 2)) & 1) {
- image[i][j][0] = 255;
- image[i][j][1] = 255;
- image[i][j][2] = 255;
- image[i][j][3] = 255;
- }
- else {
- image[i][j][0] = 128;
- image[i][j][1] = 128;
- image[i][j][2] = 128;
- image[i][j][3] = 128;
- }
- }
- }
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, image);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glEnable(GL_TEXTURE_2D);
- }
- if (SingleBuffer) {
- glDrawBuffer(GL_FRONT);
- glReadBuffer(GL_FRONT);
- }
- else {
- glDrawBuffer(GL_BACK);
- }
-
- XMapWindow(dpy, win);
-
- /* wait for window to get mapped */
- {
- XEvent e;
- while (1) {
- XNextEvent(dpy, &e);
- if (e.type == MapNotify && e.xmap.window == win) {
- break;
- }
- }
- }
-
- event_loop(dpy, win);
-
- glXDestroyContext(dpy, ctx);
- XDestroyWindow(dpy, win);
-
- XCloseDisplay(dpy);
-
- return 0;
-}
-
-
-static void
-usage(void)
-{
- printf("Usage:\n");
- printf(" -f N render N frames (default %d)\n", NumFrames);
- printf(" -d N do N display cycles\n");
- printf(" -t texturing\n");
- printf(" -s single buffering\n");
- printf(" -n no usleep() delay\n");
-}
-
-
-static void
-parse_args(int argc, char *argv[])
-{
- int i;
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-f") == 0) {
- NumFrames = atoi(argv[i + 1]);
- i++;
- }
- else if (strcmp(argv[i], "-d") == 0) {
- NumDisplays = atoi(argv[i + 1]);
- i++;
- }
- else if (strcmp(argv[i], "-n") == 0) {
- Sleeps = GL_FALSE;
- }
- else if (strcmp(argv[i], "-s") == 0) {
- SingleBuffer = GL_TRUE;
- }
- else if (strcmp(argv[i], "-t") == 0) {
- Texture = GL_TRUE;
- }
- else {
- usage();
- exit(1);
- }
- }
-}
-
-
-int
-main(int argc, char *argv[])
-{
- int i;
-
- parse_args(argc, argv);
-
- for (i = 0; i < NumDisplays; i++) {
- if (runtest() != 0)
- break;
- }
-
- return 0;
-}
diff --git a/progs/miniglx/sample_server.c b/progs/miniglx/sample_server.c
deleted file mode 100644
index 62456eca259..00000000000
--- a/progs/miniglx/sample_server.c
+++ /dev/null
@@ -1,111 +0,0 @@
-
-/*
- * Sample server that just keeps first available window mapped.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <GL/gl.h>
-#include <GL/miniglx.h>
-
-struct client {
- struct client *next;
- Window windowid;
- int mappable;
-};
-
-struct client *clients = 0, *mapped_client = 0;
-
-
-static struct client *find_client( Window id )
-{
- struct client *c;
-
- for (c = clients ; c ; c = c->next)
- if (c->windowid == id)
- return c;
-
- return 0;
-}
-
-int main( int argc, char *argv[] )
-{
- Display *dpy;
- XEvent ev;
-
- dpy = __miniglx_StartServer(NULL);
- if (!dpy) {
- fprintf(stderr, "Error: __miniglx_StartServer failed\n");
- return 1;
- }
-
- while (XNextEvent( dpy, &ev )) {
- struct client *c;
-
- switch (ev.type) {
- case MapRequest:
- fprintf(stderr, "MapRequest\n");
- c = find_client(ev.xmaprequest.window);
- if (!c) break;
- c->mappable = True;
- break;
-
- case UnmapNotify:
- fprintf(stderr, "UnmapNotify\n");
- c = find_client(ev.xunmap.window);
- if (!c) break;
- c->mappable = False;
- if (c == mapped_client)
- mapped_client = 0;
- break;
-
- case CreateNotify:
- fprintf(stderr, "CreateNotify\n");
- c = malloc(sizeof(*c));
- c->next = clients;
- c->windowid = ev.xcreatewindow.window;
- c->mappable = False;
- clients = c;
- break;
-
- case DestroyNotify:
- fprintf(stderr, "DestroyNotify\n");
- c = find_client(ev.xdestroywindow.window);
- if (!c) break;
- if (c == clients)
- clients = c->next;
- else {
- struct client *t;
- for (t = clients ; t->next != c ; t = t->next)
- ;
- t->next = c->next;
- }
-
- if (c == mapped_client)
- mapped_client = 0;
-
- free(c);
- break;
-
- default:
- break;
- }
-
- /* Search for first mappable client if none already mapped.
- */
- if (!mapped_client) {
- for (c = clients ; c ; c = c->next) {
- if (c->mappable) {
- XMapWindow( dpy, c->windowid );
- mapped_client = c;
- break;
- }
- }
- }
- }
-
- XCloseDisplay( dpy );
-
- return 0;
-}
diff --git a/progs/miniglx/sample_server2.c b/progs/miniglx/sample_server2.c
deleted file mode 100644
index efd382a6d93..00000000000
--- a/progs/miniglx/sample_server2.c
+++ /dev/null
@@ -1,228 +0,0 @@
-
-/*
- * Sample server that just keeps first available window mapped.
- *
- * It also reads and echos anything that happens on stdin as an
- * example of tracking events from sources other than miniglx clients.
- *
- * It reads & writes without blocking, so that eg. piping a lot of
- * text to stdin and then hitting 'ctrl-S' on the output stream won't
- * cause it to stop handling miniglx events.
- *
- * See select_tut in the linux manual pages for a good overview of the
- * select(2) system call.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <GL/gl.h>
-#include <GL/miniglx.h>
-#include <errno.h>
-#include <assert.h>
-
-struct client {
- struct client *next;
- Window windowid;
- int mappable;
-};
-
-struct client *clients = 0, *mapped_client = 0;
-
-#define BUFSZ 4096
-char rbuf[BUFSZ];
-int rbuf_count;
-
-
-static struct client *find_client( Window id )
-{
- struct client *c;
-
- for (c = clients ; c ; c = c->next)
- if (c->windowid == id)
- return c;
-
- return 0;
-}
-
-int main( int argc, char *argv[] )
-{
- Display *dpy;
- XEvent ev;
- int autostart = 0;
-
- if (argc == 2 && strcmp(argv[1], "-autostart") == 0)
- autostart = 1;
-
- dpy = __miniglx_StartServer(NULL);
- if (!dpy) {
- fprintf(stderr, "Error: __miniglx_StartServer failed\n");
- return 1;
- }
-
- /* How is vt switching communicated through the XNextEvent interface?
- */
- while (1) {
- int r, n;
- struct timeval tv;
- fd_set rfds, wfds;
- int bored = 0;
-
- FD_ZERO(&rfds);
- FD_ZERO(&wfds);
- tv.tv_sec = 1;
- tv.tv_usec = 0;
-
- if (rbuf_count) {
- FD_SET( 1, &wfds ); /* notify when we can write out buffer */
- n = 1;
- }
- else {
- FD_SET( 0, &rfds ); /* else notify when new data to read */
- n = 0;
- }
-
- /* __miniglx_Select waits until any of these file groups becomes
- * readable/writable/etc (like regular select), until timeout
- * expires (like regular select), until a signal is received
- * (like regular select) or until an event is available for
- * XCheckMaskEvent().
- */
- r = __miniglx_Select( dpy, n+1, &rfds, &wfds, 0, &tv );
-
- /* This can happen if select() is interrupted by a signal:
- */
- if (r < 0 && errno != EINTR && errno != EAGAIN) {
- perror ("select()");
- exit (1);
- }
-
- if (tv.tv_sec == 0 && tv.tv_usec == 0)
- bored = 1;
-
- /* Check and handle events on our local file descriptors
- */
- if (FD_ISSET( 0, &rfds )) {
- /* Something on stdin */
- assert(rbuf_count == 0);
- r = read(0, rbuf, BUFSZ);
- if (r < 1) {
- perror("read");
- abort();
- }
- rbuf_count = r;
- }
-
- if (FD_ISSET( 1, &wfds )) {
- /* Can write to stdout */
- assert(rbuf_count > 0);
- r = write(1, rbuf, rbuf_count);
- if (r < 1) {
- perror("write");
- abort();
- }
- rbuf_count -= r;
- if (rbuf_count)
- memmove(rbuf + r, rbuf, rbuf_count);
- }
-
-
- /* Check and handle events generated by miniglx:
- */
- while (XCheckMaskEvent( dpy, ~0, &ev )) {
- struct client *c;
- bored = 0;
-
- fprintf(stderr, "Received event %d\n", ev.type);
-
- switch (ev.type) {
- case CreateNotify:
- fprintf(stderr, "CreateNotify -- new client\n");
- c = malloc(sizeof(*c));
- c->next = clients;
- c->windowid = ev.xcreatewindow.window;
- c->mappable = False;
- clients = c;
- break;
-
- case DestroyNotify:
- fprintf(stderr, "DestroyNotify\n");
- c = find_client(ev.xdestroywindow.window);
- if (!c) break;
- if (c == clients)
- clients = c->next;
- else {
- struct client *t;
- for (t = clients ; t->next != c ; t = t->next)
- ;
- t->next = c->next;
- }
-
- if (c == mapped_client)
- mapped_client = 0;
-
- free(c);
- break;
-
- case MapRequest:
- fprintf(stderr, "MapRequest\n");
- c = find_client(ev.xmaprequest.window);
- if (!c) break;
- c->mappable = True;
- break;
-
- case UnmapNotify:
- fprintf(stderr, "UnmapNotify\n");
- c = find_client(ev.xunmap.window);
- if (!c) break;
- c->mappable = False;
- if (c == mapped_client)
- mapped_client = 0;
- break;
-
- default:
- break;
- }
- }
-
-
- /* Search for first mappable client if none already mapped.
- */
- if (!mapped_client) {
- struct client *c;
- for (c = clients ; c ; c = c->next) {
- if (c->mappable) {
- XMapWindow( dpy, c->windowid );
- mapped_client = c;
- break;
- }
- }
- if (!clients && autostart) {
- system("nohup ./texline &");
- system("nohup ./manytex &");
- }
- }
- else if (bored) {
- struct client *c;
- /* bored of mapped client now, let's try & find another one */
- for (c = mapped_client->next ; c && !c->mappable ; c = c->next)
- ;
- if (!c)
- for (c = clients ; c && !c->mappable ; c = c->next)
- ;
- if (c && c != mapped_client) {
- XUnmapWindow( dpy, mapped_client->windowid );
- XMapWindow( dpy, c->windowid );
- mapped_client = c;
- }
- else
- fprintf(stderr, "I'm bored!\n");
- }
- }
-
- XCloseDisplay( dpy );
-
- return 0;
-}
diff --git a/progs/miniglx/texline.c b/progs/miniglx/texline.c
deleted file mode 100644
index 098077f2474..00000000000
--- a/progs/miniglx/texline.c
+++ /dev/null
@@ -1,267 +0,0 @@
-
-/*
- * Test textured lines.
- *
- * Brian Paul
- * September 2000
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-#include "../util/readtex.c" /* I know, this is a hack. */
-
-#define TEXTURE_FILE "../images/girl.rgb"
-
-static GLboolean Antialias = GL_FALSE;
-static GLboolean Animate = GL_FALSE;
-static GLint Texture = 1;
-static GLboolean Stipple = GL_FALSE;
-static GLfloat LineWidth = 1.0;
-
-static GLfloat Xrot = -60.0, Yrot = 0.0, Zrot = 0.0;
-static GLfloat DYrot = 1.0;
-static GLboolean Points = GL_FALSE;
-static GLfloat Scale = 1.0;
-
-static void Idle( void )
-{
- if (Animate) {
- Zrot += DYrot;
- glutPostRedisplay();
- }
-}
-
-
-static void Display( void )
-{
- GLfloat x, y, s, t;
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- glScalef(Scale, Scale, Scale);
-
- if (Texture)
- glColor3f(1, 1, 1);
-
- if (Points) {
- glBegin(GL_POINTS);
- for (t = 0.0; t <= 1.0; t += 0.025) {
- for (s = 0.0; s <= 1.0; s += 0.025) {
- x = s * 2.0 - 1.0;
- y = t * 2.0 - 1.0;
- if (!Texture)
- glColor3f(1, 0, 1);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, t, s);
- glTexCoord2f(s, t);
- glVertex2f(x, y);
- }
- }
- glEnd();
- }
- else {
- glBegin(GL_LINES);
- for (t = 0.0; t <= 1.0; t += 0.025) {
- x = t * 2.0 - 1.0;
- if (!Texture)
- glColor3f(1, 0, 1);
- glTexCoord2f(t, 0.0);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, t);
- glVertex2f(x, -1.0);
- if (!Texture)
- glColor3f(0, 1, 0);
- glTexCoord2f(t, 1.0);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, t);
- glVertex2f(x, 1.0);
- }
- glEnd();
- }
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- GLfloat ar = (float) width / height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, 10.0, 100.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -12.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Antialias = !Antialias;
- if (Antialias) {
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_POINT_SMOOTH);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- }
- else {
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_POINT_SMOOTH);
- glDisable(GL_BLEND);
- }
- break;
- case 't':
- Texture++;
- if (Texture > 2)
- Texture = 0;
- if (Texture == 0) {
- glActiveTextureARB(GL_TEXTURE0_ARB);
- glDisable(GL_TEXTURE_2D);
- glActiveTextureARB(GL_TEXTURE1_ARB);
- glDisable(GL_TEXTURE_2D);
- }
- else if (Texture == 1) {
- glActiveTextureARB(GL_TEXTURE0_ARB);
- glEnable(GL_TEXTURE_2D);
- glActiveTextureARB(GL_TEXTURE1_ARB);
- glDisable(GL_TEXTURE_2D);
- }
- else {
- glActiveTextureARB(GL_TEXTURE0_ARB);
- glEnable(GL_TEXTURE_2D);
- glActiveTextureARB(GL_TEXTURE1_ARB);
- glEnable(GL_TEXTURE_2D);
- }
- break;
- case 'w':
- LineWidth -= 0.25;
- if (LineWidth < 0.25)
- LineWidth = 0.25;
- glLineWidth(LineWidth);
- glPointSize(LineWidth);
- break;
- case 'W':
- LineWidth += 0.25;
- if (LineWidth > 8.0)
- LineWidth = 8.0;
- glLineWidth(LineWidth);
- glPointSize(LineWidth);
- break;
- case 'p':
- Points = !Points;
- break;
- case 's':
- Stipple = !Stipple;
- if (Stipple)
- glEnable(GL_LINE_STIPPLE);
- else
- glDisable(GL_LINE_STIPPLE);
- break;
- case ' ':
- Animate = !Animate;
- if (Animate)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 27:
- exit(0);
- break;
- }
- printf("LineWidth, PointSize = %f\n", LineWidth);
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- float step = 3.0;
- (void) x;
- (void) y;
-
- switch (key) {
- case GLUT_KEY_UP:
- Xrot += step;
- break;
- case GLUT_KEY_DOWN:
- Xrot -= step;
- break;
- case GLUT_KEY_LEFT:
- Yrot += step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot -= step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( int argc, char *argv[] )
-{
- GLuint u;
- for (u = 0; u < 2; u++) {
- glActiveTextureARB(GL_TEXTURE0_ARB + u);
- glBindTexture(GL_TEXTURE_2D, 10+u);
- if (u == 0)
- glEnable(GL_TEXTURE_2D);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- if (u == 0)
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- else
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
- printf("Error: couldn't load texture image\n");
- exit(1);
- }
- }
-
- glLineStipple(1, 0xff);
-
- if (argc > 1 && strcmp(argv[1], "-info")==0) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowSize( 400, 300 );
-
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
-
- glutCreateWindow(argv[0] );
-
- Init(argc, argv);
-
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- if (Animate)
- glutIdleFunc( Idle );
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/rbug/bin_to_bmp.c b/progs/rbug/bin_to_bmp.c
index 40ae6290909..99a7ec5bc55 100644
--- a/progs/rbug/bin_to_bmp.c
+++ b/progs/rbug/bin_to_bmp.c
@@ -48,7 +48,7 @@ int main(int argc, char** argv)
unsigned stride = width * 4;
unsigned size = stride * height;
const char *filename = "mybin.bin";
- enum pipe_format format = PIPE_FORMAT_A8R8G8B8_UNORM;
+ enum pipe_format format = PIPE_FORMAT_B8G8R8A8_UNORM;
dump(width, height, stride, format, rbug_read(filename, size), size);
diff --git a/progs/redbook/convolution.c b/progs/redbook/convolution.c
index 0898ef25e10..c04a8727a71 100644
--- a/progs/redbook/convolution.c
+++ b/progs/redbook/convolution.c
@@ -75,6 +75,7 @@ readImage( const char* filename, GLsizei* width, GLsizei *height )
{
int n;
GLubyte* pixels;
+ size_t num_read;
FILE* infile = fopen( filename, "rb" );
@@ -83,8 +84,10 @@ readImage( const char* filename, GLsizei* width, GLsizei *height )
exit(1);
}
- fread( width, sizeof( GLsizei ), 1, infile );
- fread( height, sizeof( GLsizei ), 1, infile );
+ num_read = fread( width, sizeof( GLsizei ), 1, infile );
+ assert(num_read == 1);
+ num_read = fread( height, sizeof( GLsizei ), 1, infile );
+ assert(num_read == 1);
*width = bswap(*width);
*height = bswap(*height);
@@ -101,7 +104,8 @@ readImage( const char* filename, GLsizei* width, GLsizei *height )
return NULL;
}
- fread( pixels, sizeof( GLubyte ), n, infile );
+ num_read = fread( pixels, sizeof( GLubyte ), n, infile );
+ assert(num_read == n);
fclose( infile );
diff --git a/progs/redbook/histogram.c b/progs/redbook/histogram.c
index 70a52825772..12b0e315ca1 100644
--- a/progs/redbook/histogram.c
+++ b/progs/redbook/histogram.c
@@ -83,6 +83,7 @@ readImage( const char* filename, GLsizei* width, GLsizei *height )
{
int n;
GLubyte* pixels;
+ size_t num_read;
FILE* infile = fopen( filename, "rb" );
@@ -91,8 +92,10 @@ readImage( const char* filename, GLsizei* width, GLsizei *height )
exit(1);
}
- fread( width, sizeof( GLsizei ), 1, infile );
- fread( height, sizeof( GLsizei ), 1, infile );
+ num_read = fread( width, sizeof( GLsizei ), 1, infile );
+ assert(num_read == 1);
+ num_read = fread( height, sizeof( GLsizei ), 1, infile );
+ assert(num_read == 1);
*width = bswap(*width);
*height = bswap(*height);
@@ -106,7 +109,8 @@ readImage( const char* filename, GLsizei* width, GLsizei *height )
return NULL;
}
- fread( pixels, sizeof( GLubyte ), n, infile );
+ num_read = fread( pixels, sizeof( GLubyte ), n, infile );
+ assert(num_read == n);
fclose( infile );
diff --git a/progs/redbook/minmax.c b/progs/redbook/minmax.c
index 8281800ba43..2c1356c9de4 100644
--- a/progs/redbook/minmax.c
+++ b/progs/redbook/minmax.c
@@ -47,6 +47,7 @@
*/
#include <GL/glew.h>
#include <GL/glut.h>
+#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
@@ -78,6 +79,7 @@ readImage( const char* filename, GLsizei* width, GLsizei *height )
{
int n;
GLubyte* pixels;
+ size_t num_read;
FILE* infile = fopen( filename, "rb" );
@@ -86,8 +88,10 @@ readImage( const char* filename, GLsizei* width, GLsizei *height )
return NULL;
}
- fread( width, sizeof( GLsizei ), 1, infile );
- fread( height, sizeof( GLsizei ), 1, infile );
+ num_read = fread( width, sizeof( GLsizei ), 1, infile );
+ assert(num_read == 1);
+ num_read = fread( height, sizeof( GLsizei ), 1, infile );
+ assert(num_read == 1);
*width = bswap(*width);
*height = bswap(*height);
@@ -101,7 +105,8 @@ readImage( const char* filename, GLsizei* width, GLsizei *height )
return NULL;
}
- fread( pixels, sizeof( GLubyte ), n, infile );
+ num_read = fread( pixels, sizeof( GLubyte ), n, infile );
+ assert(num_read == n);
fclose( infile );
diff --git a/progs/tests/.gitignore b/progs/tests/.gitignore
index 8b3e9f35583..d905fab6117 100644
--- a/progs/tests/.gitignore
+++ b/progs/tests/.gitignore
@@ -104,6 +104,7 @@ vptorus
vpwarpmesh
yuvrect
yuvsquare
+zbitmap
zcomp
zdrawpix
zreaddraw
diff --git a/progs/tests/Makefile b/progs/tests/Makefile
index d33415ab052..67efc3b7a9c 100644
--- a/progs/tests/Makefile
+++ b/progs/tests/Makefile
@@ -120,6 +120,7 @@ SOURCES = \
vpwarpmesh.c \
yuvrect.c \
yuvsquare.c \
+ zbitmap.c \
zcomp.c \
zdrawpix.c \
zreaddraw.c
@@ -157,7 +158,7 @@ clean:
# auto code generation
getprocaddress: getprocaddress.c getproclist.h
-getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py
+getproclist.h: $(TOP)/src/mesa/glapi/gen/gl_API.xml getprocaddress.c getprocaddress.py
python getprocaddress.py > getproclist.h
arraytexture: arraytexture.o readtex.o
diff --git a/progs/tests/SConscript b/progs/tests/SConscript
index 04e4bdf8c22..3580ba914db 100644
--- a/progs/tests/SConscript
+++ b/progs/tests/SConscript
@@ -118,6 +118,7 @@ progs = [
'vpwarpmesh',
'yuvrect',
'yuvsquare',
+ 'zbitmap',
'zcomp',
'zdrawpix',
'zreaddraw',
diff --git a/progs/tests/fbotest1.c b/progs/tests/fbotest1.c
index 0cd7f95c355..a95fdff74c3 100644
--- a/progs/tests/fbotest1.c
+++ b/progs/tests/fbotest1.c
@@ -36,8 +36,8 @@ Display( void )
/* draw to user framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
- glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
- glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
+ glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -161,7 +161,7 @@ Init( void )
assert(i == MyFB);
CheckError(__LINE__);
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT,
+ glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_RENDERBUFFER_EXT, MyRB);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
diff --git a/progs/tests/fbotest2.c b/progs/tests/fbotest2.c
index f9c506193f6..872b46279e6 100644
--- a/progs/tests/fbotest2.c
+++ b/progs/tests/fbotest2.c
@@ -40,8 +40,8 @@ Display( void )
/* draw to user framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
- glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
- glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
+ glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -163,7 +163,7 @@ Init( void )
glGenRenderbuffersEXT(1, &ColorRb);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb);
assert(glIsRenderbufferEXT(ColorRb));
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT,
+ glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_RENDERBUFFER_EXT, ColorRb);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
diff --git a/progs/tests/fbotest3.c b/progs/tests/fbotest3.c
index 8e288b38b83..c176f82d2ba 100644
--- a/progs/tests/fbotest3.c
+++ b/progs/tests/fbotest3.c
@@ -50,8 +50,8 @@ Display( void )
/* draw to user framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
- glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
- glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
+ glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -189,7 +189,7 @@ Init( void )
glGenRenderbuffersEXT(1, &ColorRb);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb);
assert(glIsRenderbufferEXT(ColorRb));
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT,
+ glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_RENDERBUFFER_EXT, ColorRb);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
diff --git a/progs/tests/getprocaddress.py b/progs/tests/getprocaddress.py
index 699195bd48c..60111cb8010 100644
--- a/progs/tests/getprocaddress.py
+++ b/progs/tests/getprocaddress.py
@@ -4,7 +4,7 @@
# Helper for the getprocaddress.c test.
import sys, getopt, re
-sys.path.append("../../src/mesa/glapi/" )
+sys.path.append("../../src/mesa/glapi/gen" )
import gl_XML
import license
@@ -74,7 +74,7 @@ static struct name_test_pair functions[] = {"""
if __name__ == '__main__':
- file_name = "../../src/mesa/glapi/gl_API.xml"
+ file_name = "../../src/mesa/glapi/gen/gl_API.xml"
try:
(args, trail) = getopt.getopt(sys.argv[1:], "f:")
diff --git a/progs/tests/texwrap.c b/progs/tests/texwrap.c
index 39c55919dd2..bb26635d670 100644
--- a/progs/tests/texwrap.c
+++ b/progs/tests/texwrap.c
@@ -31,6 +31,7 @@
#define BORDER_TEXTURE 1
#define NO_BORDER_TEXTURE 2
+#define COLOR_TEX_CORNERS 0
#define SIZE 8
static GLubyte BorderImage[SIZE+2][SIZE+2][4];
@@ -281,6 +282,37 @@ static void Init( void )
for (i = 0; i < SIZE; i++) {
for (j = 0; j < SIZE; j++) {
+#if COLOR_TEX_CORNERS
+ if (i == 0 && j == 0) {
+ /* lower-left texel = RED */
+ NoBorderImage[i][j][0] = 255;
+ NoBorderImage[i][j][1] = 0;
+ NoBorderImage[i][j][2] = 0;
+ NoBorderImage[i][j][3] = 255;
+ }
+ else if (i == 0 && j == SIZE-1) {
+ /* lower-right corner = GREEN */
+ NoBorderImage[i][j][0] = 0;
+ NoBorderImage[i][j][1] = 255;
+ NoBorderImage[i][j][2] = 0;
+ NoBorderImage[i][j][3] = 255;
+ }
+ else if (i == SIZE-1 && j == 0) {
+ /* upper-left corner = BLUE */
+ NoBorderImage[i][j][0] = 0;
+ NoBorderImage[i][j][1] = 0;
+ NoBorderImage[i][j][2] = 255;
+ NoBorderImage[i][j][3] = 255;
+ }
+ else if (i == SIZE-1 && j == SIZE-1) {
+ /* upper-right corner = YELLOW */
+ NoBorderImage[i][j][0] = 255;
+ NoBorderImage[i][j][1] = 255;
+ NoBorderImage[i][j][2] = 0;
+ NoBorderImage[i][j][3] = 255;
+ }
+ else
+#endif
if ((i + j) & 1) {
/* white */
NoBorderImage[i][j][0] = 255;
diff --git a/progs/tests/zbitmap.c b/progs/tests/zbitmap.c
new file mode 100644
index 00000000000..45cb7543c2a
--- /dev/null
+++ b/progs/tests/zbitmap.c
@@ -0,0 +1,127 @@
+/*
+ * Test Z values of glBitmap.
+ * Brian Paul
+ * 19 Feb 2010
+ */
+
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+
+
+static GLint Win = 0;
+
+
+static void
+PrintString(const char *s)
+{
+ while (*s) {
+ glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
+ s++;
+ }
+}
+
+
+static void
+Display(void)
+{
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(-3.0, 3.0, -3.0, 3.0, -2.0, 2.0);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+
+ glColor3f(1, 1, 1);
+ glRasterPos2f(-2.0, 2.6);
+ PrintString("Z = -1.0");
+ glRasterPos2f(-0.5, 2.6);
+ PrintString("Z = 0.0");
+ glRasterPos2f(1.0, 2.6);
+ PrintString("Z = 1.0");
+
+ glColor3f(0, 0.4, 0.6);
+ glBegin(GL_QUADS);
+ glVertex3f(-2.0, -2.5, -1);
+ glVertex3f(-1.0, -2.5, -1);
+ glVertex3f(-1.0, 2.5, -1);
+ glVertex3f(-2.0, 2.5, -1);
+
+ glVertex3f(-0.5, -2.5, 0);
+ glVertex3f(0.5, -2.5, 0);
+ glVertex3f(0.5, 2.5, 0);
+ glVertex3f(-0.5, 2.5, 0);
+
+ glVertex3f(1.0, -2.5, 1);
+ glVertex3f(2.0, -2.5, 1);
+ glVertex3f(2.0, 2.5, 1);
+ glVertex3f(1.0, 2.5, 1);
+ glEnd();
+
+ glColor3f(1, 1, 1);
+
+ glRasterPos3f(-2.0, -1, -1.0);
+ PrintString("This is a bitmap string drawn at z = -1.0");
+
+ glRasterPos3f(-2.0, 0, 0.0);
+ PrintString("This is a bitmap string drawn at z = 0.0");
+
+ glRasterPos3f(-2.0, 1, 1.0);
+ PrintString("This is a bitmap string drawn at z = 1.0");
+
+ glRasterPos3f(-1.5, -2.8, 0.0);
+ PrintString("GL_DEPTH_FUNC = GL_LEQUAL");
+
+ glutSwapBuffers();
+}
+
+
+static void
+Reshape(int width, int height)
+{
+ glViewport(0, 0, width, height);
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+ if (key == 27) {
+ glutDestroyWindow(Win);
+ exit(0);
+ }
+ glutPostRedisplay();
+}
+
+
+static void
+Init(void)
+{
+ glClearColor(0.25, 0.25, 0.25, 0.0);
+ glDepthFunc(GL_LEQUAL);
+ glEnable(GL_DEPTH_TEST);
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ glutInitWindowSize(400, 400);
+ glutInit(&argc, argv);
+ glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
+ Win = glutCreateWindow(argv[0]);
+ glewInit();
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Display);
+ Init();
+ glutMainLoop();
+ return 0;
+}
diff --git a/progs/tools/trace/Makefile b/progs/tools/trace/Makefile
index 822e466ad1b..32fea2c4dd8 100644
--- a/progs/tools/trace/Makefile
+++ b/progs/tools/trace/Makefile
@@ -20,7 +20,7 @@ $(TRACER): $(OBJECTS)
-ldflags '$(LDFLAGS)' $(MKLIB_OPTIONS) $(OBJECTS)
gltrace.cc: gltrace.py
- PYTHONPATH=$(TOP)/src/mesa/glapi python gltrace.py -f $(TOP)/src/mesa/glapi/gl_API.xml > gltrace.cc
+ PYTHONPATH=$(TOP)/src/mesa/glapi/gen python gltrace.py -f $(TOP)/src/mesa/glapi/gen/gl_API.xml > gltrace.cc
clean:
diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile
index 6c78ae90a96..b4a903cb68f 100644
--- a/progs/trivial/Makefile
+++ b/progs/trivial/Makefile
@@ -205,14 +205,6 @@ default: $(UTIL_FILES) $(PROGS)
clean:
-rm -f $(PROGS)
-rm -f *.o
- -rm -f getproclist.h
-
-
-# auto code generation
-getprocaddress: getprocaddress.c getproclist.h
-
-getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py
- python getprocaddress.py > getproclist.h
texrect: texrect.o readtex.o
diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript
index 87a4d2164bd..f480da047eb 100644
--- a/progs/trivial/SConscript
+++ b/progs/trivial/SConscript
@@ -158,7 +158,7 @@ for prog in progs:
# auto code generation
#getprocaddress: getprocaddress.c getproclist.h
-#getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py
+#getproclist.h: $(TOP)/src/mesa/glapi/gen/gl_API.xml getprocaddress.c getprocaddress.py
# python getprocaddress.py > getproclist.h
diff --git a/progs/windml/Makefile.ugl b/progs/windml/Makefile.ugl
deleted file mode 100644
index 90b0b29bc82..00000000000
--- a/progs/windml/Makefile.ugl
+++ /dev/null
@@ -1,68 +0,0 @@
-# Mesa 3-D graphics library
-# Version: 3.5
-#
-# Copyright (C) 2001 Wind River Systems, Inc
-
-# The MIT License
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
-# Makefile for UGL/Mesa demos
-
-DEMO_SOURCES = readtex.c uglaccum.c uglalldemos.c uglbounce.c uglcube.c \
-ugldrawpix.c uglflip.c uglgears.c uglicotorus.c uglline.c uglolympic.c \
-uglpoint.c uglstencil.c uglteapot.c ugltexcube.c ugltexcyl.c
-#win2d3d/winRoot.c win2d3d/winBall.c win2d3d/winPuzzle.c win2d3d/winHello.c \
-#win2d3d/winImage.c win2d3d/winGears.c
-
-DEMO_OBJECTS = $(DEMO_SOURCES:.c=.o)
-
-SOURCES = $(DEMO_SOURCES)
-
-include ../rules.windml
-
-##### TARGETS #####
-
-all: depend.$(CPU)$(TOOL) $(DEMO_OBJECTS)
-
-depend.$(CPU)$(TOOL):
-ifeq ($(WIND_HOST_TYPE),x86-win32)
- @ $(RM) $@
- @ $(ECHO) Creating depend.$(CPU)$(TOOL)
-ifneq ($(SOURCES),)
- @ for %f in ($(SOURCES)) do \
- $(CC) -MM $(CFLAGS) %f >>$@
-endif
-else
-Makefile
- @ $(RM) $@
- @ $(ECHO) "Creating depend.$(CPU)$(TOOL)"
-ifneq ($(SOURCES),)
- @ for FILE in $(filter-out $(NODEPENDOBJS), $(SOURCES)); \
- do \
- $(CC) -MM $(CFLAGS) $$FILE \
- | $(TCL) $(BIN_DIR)/depend.tcl $(TGT_DIR) >>$@; \
- done
-endif
-endif
-
-.PHONY = clean
-
-clean:
- $(RM) $(DEMO_OBJECTS)
- $(RM) depend.$(CPU)$(TOOL)
diff --git a/progs/windml/readtex.c b/progs/windml/readtex.c
deleted file mode 100644
index 659c49de8de..00000000000
--- a/progs/windml/readtex.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/* readtex.c */
-
-/*
- * Read an SGI .rgb image file and generate a mipmap texture set.
- * Much of this code was borrowed from SGI's tk OpenGL toolkit.
- */
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "../util/readtex.h"
-
-
-#ifndef SEEK_SET
-# define SEEK_SET 0
-#endif
-
-
-/*
-** RGB Image Structure
-*/
-
-typedef struct _TK_RGBImageRec {
- GLint sizeX, sizeY;
- GLint components;
- unsigned char *data;
-} TK_RGBImageRec;
-
-
-
-/******************************************************************************/
-
-typedef struct _rawImageRec {
- unsigned short imagic;
- unsigned short type;
- unsigned short dim;
- unsigned short sizeX, sizeY, sizeZ;
- unsigned long min, max;
- unsigned long wasteBytes;
- char name[80];
- unsigned long colorMap;
- FILE *file;
- unsigned char *tmp, *tmpR, *tmpG, *tmpB, *tmpA;
- unsigned long rleEnd;
- GLuint *rowStart;
- GLint *rowSize;
-} rawImageRec;
-
-/******************************************************************************/
-
-static void ConvertShort(unsigned short *array, long length)
-{
- unsigned long b1, b2;
- unsigned char *ptr;
-
- ptr = (unsigned char *)array;
- while (length--) {
- b1 = *ptr++;
- b2 = *ptr++;
- *array++ = (unsigned short) ((b1 << 8) | (b2));
- }
-}
-
-static void ConvertLong(GLuint *array, long length)
-{
- unsigned long b1, b2, b3, b4;
- unsigned char *ptr;
-
- ptr = (unsigned char *)array;
- while (length--) {
- b1 = *ptr++;
- b2 = *ptr++;
- b3 = *ptr++;
- b4 = *ptr++;
- *array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4);
- }
-}
-
-static rawImageRec *RawImageOpen(const char *fileName)
-{
- union {
- int testWord;
- char testByte[4];
- } endianTest;
- rawImageRec *raw;
- GLenum swapFlag;
- int x;
-
- endianTest.testWord = 1;
- if (endianTest.testByte[0] == 1) {
- swapFlag = GL_TRUE;
- } else {
- swapFlag = GL_FALSE;
- }
-
- raw = (rawImageRec *)malloc(sizeof(rawImageRec));
- if (raw == NULL) {
- fprintf(stderr, "Out of memory!\n");
- return NULL;
- }
- if ((raw->file = fopen(fileName, "rb")) == NULL) {
- perror(fileName);
- return NULL;
- }
-
- fread(raw, 1, 12, raw->file);
-
- if (swapFlag) {
- ConvertShort(&raw->imagic, 6);
- }
-
- raw->tmp = (unsigned char *)malloc(raw->sizeX*256);
- raw->tmpR = (unsigned char *)malloc(raw->sizeX*256);
- raw->tmpG = (unsigned char *)malloc(raw->sizeX*256);
- raw->tmpB = (unsigned char *)malloc(raw->sizeX*256);
- if (raw->sizeZ==4) {
- raw->tmpA = (unsigned char *)malloc(raw->sizeX*256);
- }
- if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL ||
- raw->tmpB == NULL) {
- fprintf(stderr, "Out of memory!\n");
- return NULL;
- }
-
- if ((raw->type & 0xFF00) == 0x0100) {
- x = raw->sizeY * raw->sizeZ * sizeof(GLuint);
- raw->rowStart = (GLuint *)malloc(x);
- raw->rowSize = (GLint *)malloc(x);
- if (raw->rowStart == NULL || raw->rowSize == NULL) {
- fprintf(stderr, "Out of memory!\n");
- return NULL;
- }
- raw->rleEnd = 512 + (2 * x);
- fseek(raw->file, 512, SEEK_SET);
- fread(raw->rowStart, 1, x, raw->file);
- fread(raw->rowSize, 1, x, raw->file);
- if (swapFlag) {
- ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint)));
- ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint)));
- }
- }
- return raw;
-}
-
-static void RawImageClose(rawImageRec *raw)
-{
-
- fclose(raw->file);
- free(raw->tmp);
- free(raw->tmpR);
- free(raw->tmpG);
- free(raw->tmpB);
- if (raw->sizeZ>3) {
- free(raw->tmpA);
- }
- free(raw);
-}
-
-static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z)
-{
- unsigned char *iPtr, *oPtr, pixel;
- int count, done = 0;
-
- if ((raw->type & 0xFF00) == 0x0100) {
- fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET);
- fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY],
- raw->file);
-
- iPtr = raw->tmp;
- oPtr = buf;
- while (!done) {
- pixel = *iPtr++;
- count = (int)(pixel & 0x7F);
- if (!count) {
- done = 1;
- return;
- }
- if (pixel & 0x80) {
- while (count--) {
- *oPtr++ = *iPtr++;
- }
- } else {
- pixel = *iPtr++;
- while (count--) {
- *oPtr++ = pixel;
- }
- }
- }
- } else {
- fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY),
- SEEK_SET);
- fread(buf, 1, raw->sizeX, raw->file);
- }
-}
-
-
-static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final)
-{
- unsigned char *ptr;
- int i, j;
-
- final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4);
- if (final->data == NULL) {
- fprintf(stderr, "Out of memory!\n");
- }
-
- ptr = final->data;
- for (i = 0; i < (int)(raw->sizeY); i++) {
- RawImageGetRow(raw, raw->tmpR, i, 0);
- RawImageGetRow(raw, raw->tmpG, i, 1);
- RawImageGetRow(raw, raw->tmpB, i, 2);
- if (raw->sizeZ>3) {
- RawImageGetRow(raw, raw->tmpA, i, 3);
- }
- for (j = 0; j < (int)(raw->sizeX); j++) {
- *ptr++ = *(raw->tmpR + j);
- *ptr++ = *(raw->tmpG + j);
- *ptr++ = *(raw->tmpB + j);
- if (raw->sizeZ>3) {
- *ptr++ = *(raw->tmpA + j);
- }
- }
- }
-}
-
-
-static TK_RGBImageRec *tkRGBImageLoad(const char *fileName)
-{
- rawImageRec *raw;
- TK_RGBImageRec *final;
-
- raw = RawImageOpen(fileName);
- if (!raw) {
- fprintf(stderr, "File not found\n");
- return NULL;
- }
- final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec));
- if (final == NULL) {
- fprintf(stderr, "Out of memory!\n");
- return NULL;
- }
- final->sizeX = raw->sizeX;
- final->sizeY = raw->sizeY;
- final->components = raw->sizeZ;
- RawImageGetData(raw, final);
- RawImageClose(raw);
- return final;
-}
-
-
-static void FreeImage( TK_RGBImageRec *image )
-{
- free(image->data);
- free(image);
-}
-
-
-/*
- * Load an SGI .rgb file and generate a set of 2-D mipmaps from it.
- * Input: imageFile - name of .rgb to read
- * intFormat - internal texture format to use, or number of components
- * Return: GL_TRUE if success, GL_FALSE if error.
- */
-GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat )
-{
- GLint w, h;
- return LoadRGBMipmaps2( imageFile, GL_TEXTURE_2D, intFormat, &w, &h );
-}
-
-
-
-GLboolean LoadRGBMipmaps2( const char *imageFile, GLenum target,
- GLint intFormat, GLint *width, GLint *height )
-{
- GLint error;
- GLenum format;
- TK_RGBImageRec *image;
-
- image = tkRGBImageLoad( imageFile );
- if (!image) {
- return GL_FALSE;
- }
-
- if (image->components==3) {
- format = GL_RGB;
- }
- else if (image->components==4) {
- format = GL_RGBA;
- }
- else {
- /* not implemented */
- fprintf(stderr,
- "Error in LoadRGBMipmaps %d-component images not implemented\n",
- image->components );
- return GL_FALSE;
- }
-
- error = gluBuild2DMipmaps( target,
- intFormat,
- image->sizeX, image->sizeY,
- format,
- GL_UNSIGNED_BYTE,
- image->data );
-
- *width = image->sizeX;
- *height = image->sizeY;
-
- FreeImage(image);
-
- return error ? GL_FALSE : GL_TRUE;
-}
-
-
-
-/*
- * Load an SGI .rgb file and return a pointer to the image data.
- * Input: imageFile - name of .rgb to read
- * Output: width - width of image
- * height - height of image
- * format - format of image (GL_RGB or GL_RGBA)
- * Return: pointer to image data or NULL if error
- */
-GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height,
- GLenum *format )
-{
- TK_RGBImageRec *image;
- GLint bytes;
- GLubyte *buffer;
-
- image = tkRGBImageLoad( imageFile );
- if (!image) {
- return NULL;
- }
-
- if (image->components==3) {
- *format = GL_RGB;
- }
- else if (image->components==4) {
- *format = GL_RGBA;
- }
- else {
- /* not implemented */
- fprintf(stderr,
- "Error in LoadRGBImage %d-component images not implemented\n",
- image->components );
- return NULL;
- }
-
- *width = image->sizeX;
- *height = image->sizeY;
-
- bytes = image->sizeX * image->sizeY * image->components;
- buffer = (GLubyte *) malloc(bytes);
- if (!buffer)
- return NULL;
-
- memcpy( (void *) buffer, (void *) image->data, bytes );
-
- FreeImage(image);
-
- return buffer;
-}
-
diff --git a/progs/windml/uglaccum.c b/progs/windml/uglaccum.c
deleted file mode 100644
index fd7cb3125c1..00000000000
--- a/progs/windml/uglaccum.c
+++ /dev/null
@@ -1,250 +0,0 @@
-
-/* Copyright (c) Mark J. Kilgard, 1994. */
-
-/*
- * (c) Copyright 1993, Silicon Graphics, Inc.
- * ALL RIGHTS RESERVED
- * Permission to use, copy, modify, and distribute this software for
- * any purpose and without fee is hereby granted, provided that the above
- * copyright notice appear in all copies and that both the copyright notice
- * and this permission notice appear in supporting documentation, and that
- * the name of Silicon Graphics, Inc. not be used in advertising
- * or publicity pertaining to distribution of the software without specific,
- * written prior permission.
- *
- * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
- * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
- * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
- * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
- * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
- * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
- * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
- * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
- * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
- * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * US Government Users Restricted Rights
- * Use, duplication, or disclosure by the Government is subject to
- * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
- * (c)(1)(ii) of the Rights in Technical Data and Computer Software
- * clause at DFARS 252.227-7013 and/or in similar or successor
- * clauses in the FAR or the DOD or NASA FAR Supplement.
- * Unpublished-- rights reserved under the copyright laws of the
- * United States. Contractor/manufacturer is Silicon Graphics,
- * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
- *
- * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
- */
-
-/* Original name: accanti.c
- *
- * Conversion to UGL/Mesa by Stephane Raimbault
- */
-
-#include <stdio.h>
-#include <math.h>
-
-#include <ugl/ugl.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-
-#include <GL/uglmesa.h>
-#include <GL/uglglutshapes.h>
-
-#include "../book/jitter.h"
-
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-
-/* Initialize lighting and other values.
- */
-UGL_LOCAL void initGL(GLsizei w, GLsizei h)
- {
- GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat light_position[] = { 0.0, 0.0, 10.0, 1.0 };
- GLfloat lm_ambient[] = { 0.2, 0.2, 0.2, 1.0 };
-
- glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
- glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
- glMaterialf(GL_FRONT, GL_SHININESS, 50.0);
- glLightfv(GL_LIGHT0, GL_POSITION, light_position);
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lm_ambient);
-
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glDepthFunc(GL_LESS);
- glEnable(GL_DEPTH_TEST);
- glShadeModel (GL_FLAT);
-
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClearAccum(0.0, 0.0, 0.0, 0.0);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- if (w <= h)
- glOrtho (-2.25, 2.25, -2.25*h/w, 2.25*h/w, -10.0, 10.0);
- else
- glOrtho (-2.25*w/h, 2.25*w/h, -2.25, 2.25, -10.0, 10.0);
- glMatrixMode(GL_MODELVIEW);
- }
-
-UGL_LOCAL void displayObjects(void)
- {
- GLfloat torus_diffuse[] = { 0.7, 0.7, 0.0, 1.0 };
- GLfloat cube_diffuse[] = { 0.0, 0.7, 0.7, 1.0 };
- GLfloat sphere_diffuse[] = { 0.7, 0.0, 0.7, 1.0 };
- GLfloat octa_diffuse[] = { 0.7, 0.4, 0.4, 1.0 };
-
- glPushMatrix ();
- glRotatef (30.0, 1.0, 0.0, 0.0);
-
- glPushMatrix ();
- glTranslatef (-0.80, 0.35, 0.0);
- glRotatef (100.0, 1.0, 0.0, 0.0);
- glMaterialfv(GL_FRONT, GL_DIFFUSE, torus_diffuse);
- glutSolidTorus (0.275, 0.85, 16, 16);
- glPopMatrix ();
-
- glPushMatrix ();
- glTranslatef (-0.75, -0.50, 0.0);
- glRotatef (45.0, 0.0, 0.0, 1.0);
- glRotatef (45.0, 1.0, 0.0, 0.0);
- glMaterialfv(GL_FRONT, GL_DIFFUSE, cube_diffuse);
- glutSolidCube (1.5);
- glPopMatrix ();
-
- glPushMatrix ();
- glTranslatef (0.75, 0.60, 0.0);
- glRotatef (30.0, 1.0, 0.0, 0.0);
- glMaterialfv(GL_FRONT, GL_DIFFUSE, sphere_diffuse);
- glutSolidSphere (1.0, 16, 16);
- glPopMatrix ();
-
- glPushMatrix ();
- glTranslatef (0.70, -0.90, 0.25);
- glMaterialfv(GL_FRONT, GL_DIFFUSE, octa_diffuse);
- glutSolidOctahedron ();
- glPopMatrix ();
-
- glPopMatrix ();
- }
-
-#define ACSIZE 8
-
-UGL_LOCAL void drawGL(void)
- {
- GLint viewport[4];
- int jitter;
-
- glGetIntegerv (GL_VIEWPORT, viewport);
-
- glClear(GL_ACCUM_BUFFER_BIT);
- for (jitter = 0; jitter < ACSIZE; jitter++)
- {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glPushMatrix ();
-/* Note that 4.5 is the distance in world space between
- * left and right and bottom and top.
- * This formula converts fractional pixel movement to
- * world coordinates.
- */
- glTranslatef (j8[jitter].x*4.5/viewport[2],
- j8[jitter].y*4.5/viewport[3], 0.0);
- displayObjects ();
- glPopMatrix ();
- glAccum(GL_ACCUM, 1.0/ACSIZE);
- }
- glAccum (GL_RETURN, 1.0);
- glFlush();
-
- uglMesaSwapBuffers();
- }
-
-UGL_LOCAL int getEvent(void)
- {
- UGL_EVENT event;
- UGL_STATUS status;
- int retVal = 0;
-
- status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
-
- while (status != UGL_STATUS_Q_EMPTY)
- {
- UGL_INPUT_EVENT * pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- retVal = 1;
-
- status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
- }
-
- return(retVal);
- }
-
-void windMLAccum (UGL_BOOL windMLMode);
-
-void uglaccum (void)
- {
- taskSpawn("tAccum", 210, VX_FP_TASK, 100000,
- (FUNCPTR)windMLAccum,UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLAccum (UGL_BOOL windMLMode)
- {
- UGL_INPUT_DEVICE_ID keyboardDevId;
- GLsizei width, height;
-
- uglInitialize();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
-
- uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
-
- qId = uglEventQCreate (eventServiceId, 100);
-
- if (windMLMode)
- umc = uglMesaCreateNewContextExt(UGL_MESA_DOUBLE
- | UGL_MESA_WINDML_EXCLUSIVE,
- 16,
- 0,
- 8,8,8,0,
- NULL);
- else
- umc = uglMesaCreateNewContextExt(UGL_MESA_DOUBLE,
- 16,
- 0,
- 8,8,8,0,
- NULL);
-
- if (umc == NULL)
- {
- uglDeinitialize();
- return;
- }
-
- /* Fullscreen */
-
- uglMesaMakeCurrentContext(umc, 0, 0,
- UGL_MESA_FULLSCREEN_WIDTH,
- UGL_MESA_FULLSCREEN_HEIGHT);
-
- uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
- uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
-
- initGL(width, height);
-
- drawGL();
-
- while (!getEvent());
-
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize();
-
- return;
- }
diff --git a/progs/windml/uglalldemos.c b/progs/windml/uglalldemos.c
deleted file mode 100644
index 283e4870740..00000000000
--- a/progs/windml/uglalldemos.c
+++ /dev/null
@@ -1,198 +0,0 @@
-
-/* uglalldemos.c - WindML/Mesa example program */
-
-/* Copyright (C) 2001 by Wind River Systems, Inc */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * The MIT License
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
-modification history
---------------------
-02a,29aug01,sra WindML mode added
-01a,17jul01,sra written
-*/
-
-/*
-DESCRIPTION
-Show all the UGL/Mesa demos
-*/
-
-#include <stdio.h>
-#include <vxWorks.h>
-#include <taskLib.h>
-#include <ugl/ugl.h>
-#include <ugl/uglinput.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglfont.h>
-
-#define BLACK 0
-#define RED 1
-
-struct _colorStruct
- {
- UGL_RGB rgbColor;
- UGL_COLOR uglColor;
- }
-colorTable[] =
- {
- { UGL_MAKE_RGB(0, 0, 0), 0},
- { UGL_MAKE_RGB(255, 0, 0), 0},
- };
-
-void windMLPoint (UGL_BOOL windMLMode);
-void windMLLine (UGL_BOOL windMLMode);
-void windMLFlip (UGL_BOOL windMLMode);
-void windMLCube (UGL_BOOL windMLMode);
-void windMLBounce (UGL_BOOL windMLMode);
-void windMLGears (UGL_BOOL windMLMode);
-void windMLIcoTorus (UGL_BOOL windMLMode);
-void windMLOlympic (UGL_BOOL windMLMode);
-void windMLTexCube (UGL_BOOL windMLMode);
-void windMLTexCyl (UGL_BOOL windMLMode);
-void windMLTeapot (UGL_BOOL windMLMode);
-void windMLStencil (UGL_BOOL windMLMode);
-void windMLDrawPix (UGL_BOOL windMLMode);
-void windMLAccum (UGL_BOOL windMLMode);
-void windMLAllDemos (void);
-
-void uglalldemos (void)
- {
- taskSpawn("tAllDemos", 210, VX_FP_TASK, 200000,
- (FUNCPTR)windMLAllDemos, 0,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLAllDemos(void)
- {
- UGL_BOOL windMLFlag = UGL_FALSE;
- UGL_FB_INFO fbInfo;
- UGL_EVENT event;
- UGL_EVENT_SERVICE_ID eventServiceId;
- UGL_EVENT_Q_ID qId;
- UGL_INPUT_EVENT * pInputEvent;
- UGL_INPUT_DEVICE_ID keyboardDevId;
- UGL_DEVICE_ID devId;
- UGL_GC_ID gc;
- UGL_FONT_ID fontId;
- UGL_FONT_DEF fontDef;
- UGL_FONT_DRIVER_ID fontDrvId;
- UGL_ORD textOrigin = UGL_FONT_TEXT_UPPER_LEFT;
- int displayHeight, displayWidth;
- int textWidth, textHeight;
- static UGL_CHAR * message =
- "Do you want to use WindML exclusively ? (y/n) ";
-
- uglInitialize();
-
- uglDriverFind (UGL_DISPLAY_TYPE, 0, (UGL_UINT32 *)&devId);
- uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
- uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
- qId = uglEventQCreate (eventServiceId, 100);
-
- gc = uglGcCreate(devId);
-
- uglDriverFind (UGL_FONT_ENGINE_TYPE, 0, (UGL_UINT32 *)&fontDrvId);
- uglFontDriverInfo(fontDrvId, UGL_FONT_TEXT_ORIGIN, &textOrigin);
-
- uglFontFindString(fontDrvId, "familyName=Helvetica; pixelSize = 18",
- &fontDef);
-
- if ((fontId = uglFontCreate(fontDrvId, &fontDef)) == UGL_NULL)
- {
- printf("Font not found. Exiting.\n");
- return;
- }
-
- uglInfo(devId, UGL_FB_INFO_REQ, &fbInfo);
- displayWidth = fbInfo.width;
- displayHeight = fbInfo.height;
-
- uglColorAlloc (devId, &colorTable[BLACK].rgbColor, UGL_NULL,
- &colorTable[BLACK].uglColor, 1);
- uglColorAlloc(devId, &colorTable[RED].rgbColor, UGL_NULL,
- &colorTable[RED].uglColor, 1);
-
- uglBackgroundColorSet(gc, colorTable[BLACK].uglColor);
- uglForegroundColorSet(gc, colorTable[RED].uglColor);
- uglFontSet(gc, fontId);
- uglTextSizeGet(fontId, &textWidth, &textHeight, -1, message);
- uglTextDraw(gc, (displayWidth - textWidth) / 2,
- (displayHeight - textHeight) / 2 - textHeight, -1, message);
-/* flushQ();
- */
- if (uglEventGet (qId, &event, sizeof (event), UGL_WAIT_FOREVER)
- != UGL_STATUS_Q_EMPTY)
- {
- pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
- pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- {
- switch(pInputEvent->type.keyboard.key)
- {
- case 'Y':
- case 'y':
- windMLFlag = UGL_TRUE;
- break;
- default:
- windMLFlag = UGL_FALSE;
- }
- }
- }
-
- uglFontDestroy (fontId);
- uglGcDestroy (gc);
- uglEventQDestroy (eventServiceId, qId);
- uglDeinitialize();
-
- windMLPoint(windMLFlag);
-
- windMLLine(windMLFlag);
-
- windMLFlip(windMLFlag);
-
- windMLCube(windMLFlag);
-
- windMLBounce(windMLFlag);
-
- windMLGears(windMLFlag);
-
- windMLIcoTorus(windMLFlag);
-
- windMLOlympic(windMLFlag);
-
- windMLTexCube(windMLFlag);
-
- windMLTexCyl(windMLFlag);
-
- windMLTeapot(windMLFlag);
-
- windMLStencil(windMLFlag);
-
- windMLDrawPix(windMLFlag);
-
- windMLAccum(windMLFlag);
-
- return;
- }
diff --git a/progs/windml/uglbounce.c b/progs/windml/uglbounce.c
deleted file mode 100644
index 287015a4131..00000000000
--- a/progs/windml/uglbounce.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Bouncing ball demo.
- *
- * This program is in the public domain
- *
- * Brian Paul
- *
- * Conversion to GLUT by Mark J. Kilgard
- *
- * Conversion to UGL/Mesa by Stephane Raimbault
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <ugl/ugl.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-
-#include <GL/uglmesa.h>
-
-#define COS(X) cos( (X) * 3.14159/180.0 )
-#define SIN(X) sin( (X) * 3.14159/180.0 )
-
-#define RED 1
-#define WHITE 2
-#define CYAN 3
-
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-
-UGL_LOCAL GLuint Ball;
-UGL_LOCAL GLfloat Zrot, Zstep;
-UGL_LOCAL GLfloat Xpos, Ypos;
-UGL_LOCAL GLfloat Xvel, Yvel;
-UGL_LOCAL GLfloat Xmin, Xmax;
-UGL_LOCAL GLfloat Ymin;
-/* UGL_LOCAL GLfloat Ymax = 4.0; */
-UGL_LOCAL GLfloat G;
-
-UGL_LOCAL GLuint make_ball(void)
- {
- GLuint list;
- GLfloat a, b;
- GLfloat da = 18.0, db = 18.0;
- GLfloat radius = 1.0;
- GLuint color;
- GLfloat x, y, z;
-
- list = glGenLists(1);
-
- glNewList(list, GL_COMPILE);
-
- color = 0;
- for (a = -90.0; a + da <= 90.0; a += da)
- {
- glBegin(GL_QUAD_STRIP);
- for (b = 0.0; b <= 360.0; b += db)
- {
- if (color)
- {
- glIndexi(RED);
- glColor3f(1, 0, 0);
- }
- else
- {
- glIndexi(WHITE);
- glColor3f(1, 1, 1);
- }
-
- x = radius * COS(b) * COS(a);
- y = radius * SIN(b) * COS(a);
- z = radius * SIN(a);
- glVertex3f(x, y, z);
-
- x = radius * COS(b) * COS(a + da);
- y = radius * SIN(b) * COS(a + da);
- z = radius * SIN(a + da);
- glVertex3f(x, y, z);
-
- color = 1 - color;
- }
- glEnd();
-
- }
-
- glEndList();
-
- return list;
- }
-
-UGL_LOCAL void initGL(GLsizei width, GLsizei height)
- {
- float aspect = (float) width / (float) height;
- glViewport(0, 0, (GLint) width, (GLint) height);
-
- uglMesaSetColor(RED, 1.0, 0.0, 0.0);
- uglMesaSetColor(WHITE, 1.0, 1.0, 1.0);
- uglMesaSetColor(CYAN, 0.0, 1.0, 1.0);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-6.0 * aspect, 6.0 * aspect, -6.0, 6.0, -6.0, 6.0);
- glMatrixMode(GL_MODELVIEW);
-
- }
-
-UGL_LOCAL void drawGL(void)
- {
- GLint i;
- static float vel0 = -100.0;
-
- glClear(GL_COLOR_BUFFER_BIT);
-
- glIndexi(CYAN);
- glColor3f(0, 1, 1);
- glBegin(GL_LINES);
- for (i = -5; i <= 5; i++)
- {
- glVertex2i(i, -5);
- glVertex2i(i, 5);
- }
- for (i = -5; i <= 5; i++)
- {
- glVertex2i(-5, i);
- glVertex2i(5, i);
- }
- for (i = -5; i <= 5; i++)
- {
- glVertex2i(i, -5);
- glVertex2f(i * 1.15, -5.9);
- }
- glVertex2f(-5.3, -5.35);
- glVertex2f(5.3, -5.35);
- glVertex2f(-5.75, -5.9);
- glVertex2f(5.75, -5.9);
- glEnd();
-
- glPushMatrix();
- glTranslatef(Xpos, Ypos, 0.0);
- glScalef(2.0, 2.0, 2.0);
- glRotatef(8.0, 0.0, 0.0, 1.0);
- glRotatef(90.0, 1.0, 0.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
-
- glCallList(Ball);
-
- glPopMatrix();
-
- glFlush();
-
- uglMesaSwapBuffers();
-
- Zrot += Zstep;
-
- Xpos += Xvel;
- if (Xpos >= Xmax)
- {
- Xpos = Xmax;
- Xvel = -Xvel;
- Zstep = -Zstep;
- }
- if (Xpos <= Xmin)
- {
- Xpos = Xmin;
- Xvel = -Xvel;
- Zstep = -Zstep;
- }
- Ypos += Yvel;
- Yvel += G;
- if (Ypos < Ymin)
- {
- Ypos = Ymin;
- if (vel0 == -100.0)
- vel0 = fabs(Yvel);
- Yvel = vel0;
- }
- }
-
-UGL_LOCAL int getEvent(void)
- {
- UGL_EVENT event;
- UGL_STATUS status;
- int retVal = 0;
-
- status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
-
- while (status != UGL_STATUS_Q_EMPTY)
- {
- UGL_INPUT_EVENT * pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- retVal = 1;
-
- status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
- }
-
- return(retVal);
- }
-
-void windMLBounce (UGL_BOOL windMLMode);
-
-void uglbounce (void)
- {
- taskSpawn("tBounce", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLBounce,
- UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLBounce(UGL_BOOL windMLMode)
- {
- GLsizei width, height;
- UGL_INPUT_DEVICE_ID keyboardDevId;
-
- Zrot = 0.0;
- Zstep = 6.0;
- Xpos = 0.0;
- Ypos = 1.0;
- Xvel = 0.2;
- Yvel = 0.0;
- Xmin = -4.0;
- Xmax = 4.0;
- Ymin = -3.8;
- G = -0.1;
-
- uglInitialize();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
-
- uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
-
- qId = uglEventQCreate (eventServiceId, 100);
-
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
-
- if (umc == NULL)
- {
- uglDeinitialize();
- return;
- }
-
- /* Fullscreen */
-
- uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
- UGL_MESA_FULLSCREEN_HEIGHT);
-
- Ball = make_ball();
- glCullFace(GL_BACK);
- glEnable(GL_CULL_FACE);
- glDisable(GL_DITHER);
- glShadeModel(GL_FLAT);
-
- uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
- uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
-
- initGL(width, height);
-
- while(!getEvent())
- drawGL();
-
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize ();
-
- return;
- }
diff --git a/progs/windml/uglcube.c b/progs/windml/uglcube.c
deleted file mode 100644
index e701d8db462..00000000000
--- a/progs/windml/uglcube.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* uglcube.c - WindML/Mesa example program */
-
-/* Copyright (C) 2001 by Wind River Systems, Inc */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * The MIT License
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
-DESCRIPTION
-Draw a smooth cube.
-*/
-
-#include <stdio.h>
-#include <math.h>
-
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-
-#include <GL/uglmesa.h>
-#include <GL/glu.h>
-
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-UGL_LOCAL GLfloat rotx;
-UGL_LOCAL GLfloat roty;
-UGL_LOCAL GLuint theCube;
-
-UGL_LOCAL void cube()
- {
-
- /* Front */
- glBegin(GL_QUADS);
- glColor3f(0.0f, 0.0f, 1.0f);
- glVertex3f(-1.0f, 1.0f, 1.0f);
- glColor3f(0.0f, 1.0f, 0.0f);
- glVertex3f(1.0f, 1.0f, 1.0f);
- glColor3f(1.0f, 0.0f, 0.0f);
- glVertex3f(1.0f, -1.0f, 1.0f);
- glColor3f(1.0f, 1.0f, 0.0f);
- glVertex3f(-1.0f, -1.0f, 1.0f);
- glEnd();
-
-
- /* Back */
- glBegin(GL_QUADS);
- glColor3f(0.0f, 0.0f, 1.0f);
- glVertex3f(-1.0f, 1.0f, -1.0f);
- glColor3f(0.0f, 1.0f, 0.0f);
- glVertex3f(1.0f, 1.0f, -1.0f);
- glColor3f(1.0f, 0.0f, 0.0f);
- glVertex3f(1.0f, -1.0f, -1.0f);
- glColor3f(1.0f, 1.0f, 0.0f);
- glVertex3f(-1.0f, -1.0f, -1.0f);
- glEnd();
-
-
- /* Right */
- glBegin(GL_QUADS);
- glColor3f(0.0f, 1.0f, 0.0f);
- glVertex3f(1.0f, 1.0f, 1.0f);
- glColor3f(0.0f, 1.0f, 0.0f);
- glVertex3f(1.0f, 1.0f, -1.0f);
- glColor3f(1.0f, 0.0f, 0.0f);
- glVertex3f(1.0f, -1.0f, -1.0f);
- glColor3f(1.0f, 0.0f, 0.0f);
- glVertex3f(1.0f, -1.0f, 1.0f);
- glEnd();
-
- /* Left */
- glBegin(GL_QUADS);
- glColor3f(0.0f, 0.0f, 1.0f);
- glVertex3f(-1.0f, 1.0f, 1.0f);
- glColor3f(0.0f, 0.0f, 1.0f);
- glVertex3f(-1.0f, 1.0f, -1.0f);
- glColor3f(1.0f, 1.0f, 0.0f);
- glVertex3f(-1.0f, -1.0f, -1.0f);
- glColor3f(1.0f, 1.0f, 0.0f);
- glVertex3f(-1.0f, -1.0f, 1.0f);
- glEnd();
-
- /* Top */
- glBegin(GL_QUADS);
- glColor3f(0.0f, 0.0f, 1.0f);
- glVertex3f(-1.0f, 1.0f, -1.0f);
- glColor3f(0.0f, 1.0f, 0.0f);
- glVertex3f(1.0f, 1.0f, -1.0f);
- glColor3f(0.0f, 1.0f, 0.0f);
- glVertex3f(1.0f, 1.0f, 1.0f);
- glColor3f(0.0f, 0.0f, 1.0f);
- glVertex3f(-1.0f, 1.0f, 1.0f);
- glEnd();
-
-
- /* Bottom */
- glBegin(GL_QUADS);
- glColor3f(1.0f, 1.0f, 0.0f);
- glVertex3f(-1.0f, -1.0f, -1.0f);
- glColor3f(1.0f, 0.0f, 0.0f);
- glVertex3f(1.0f, -1.0f, -1.0f);
- glColor3f(1.0f, 0.0f, 0.0f);
- glVertex3f(1.0f, -1.0f, 1.0f);
- glColor3f(1.0f, 1.0f, 0.0f);
- glVertex3f(-1.0f, -1.0f, 1.0f);
- glEnd();
- }
-
-UGL_LOCAL void initGL
- (
- int Width,
- int Height
- )
- {
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- glDepthFunc(GL_LESS);
- glEnable(GL_DEPTH_TEST);
- glShadeModel(GL_SMOOTH);
-
- theCube = glGenLists(1);
- glNewList(theCube, GL_COMPILE);
- cube();
- glEndList();
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(45.0f, (GLfloat) Width / (GLfloat) Height, 0.1f, 100.0f);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0f, 0.0f, -6.0f);
- }
-
-
-/* The main drawing function. */
-
-UGL_LOCAL void drawGL()
- {
-
- /* Clear The Screen And The Depth Buffer */
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- /* Rotate the cube */
-
- glRotatef(rotx, 1.0f, 0.0f, 0.0f);
- glRotatef(roty, 0.0f, 1.0f, 0.0f);
-
- glCallList(theCube);
-
- glFlush();
-
- uglMesaSwapBuffers();
- }
-
-
-/* The function called whenever a key is pressed. */
-
-UGL_LOCAL int getEvent(void)
- {
- UGL_EVENT event;
- UGL_STATUS status;
- int retVal = 0;
-
- status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
-
- while (status != UGL_STATUS_Q_EMPTY)
- {
- UGL_INPUT_EVENT * pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- retVal = 1;
-
- status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
- }
-
- return(retVal);
- }
-
-void windMLCube (UGL_BOOL windMLMode);
-
-void uglcube (void)
- {
- taskSpawn("tCube", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLCube,
- UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLCube (UGL_BOOL windMLMode)
- {
- GLsizei width, height;
- UGL_INPUT_DEVICE_ID keyboardDevId;
-
- rotx = 2.5f;
- roty = 1.0f;
-
- uglInitialize();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
-
- if (uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0,
- (UGL_UINT32 *)&eventServiceId) == UGL_STATUS_OK)
- {
- qId = uglEventQCreate (eventServiceId, 100);
- }
- else
- {
- eventServiceId = UGL_NULL;
- }
-
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
-
- /* Fullscreen */
-
- uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
- UGL_MESA_FULLSCREEN_HEIGHT);
-
- uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
- uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
-
- /* Initialize our window. */
-
- initGL(width, height);
-
- while (!getEvent())
- drawGL();
-
- if (eventServiceId != UGL_NULL)
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize();
-
- return;
- }
diff --git a/progs/windml/ugldrawpix.c b/progs/windml/ugldrawpix.c
deleted file mode 100644
index 154fe55970e..00000000000
--- a/progs/windml/ugldrawpix.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * glDrawPixels demo/test/benchmark
- *
- * Brian Paul September 25, 1997 This file is in the public domain.
- *
- * Conversion to UGL/Mesa by Stephane Raimbault july, 2001
- */
-
-/*
- * Revision 1.2 2001/09/10 19:21:13 brianp
- * WindML updates (Stephane Raimbault)
- *
- * Revision 1.1 2001/08/20 16:07:11 brianp
- * WindML driver (Stephane Raimbault)
- *
- * Revision 1.5 2000/12/24 22:53:54 pesco
- * * demos/Makefile.am (INCLUDES): Added -I$(top_srcdir)/util.
- * * demos/Makefile.X11, demos/Makefile.BeOS-R4, demos/Makefile.cygnus:
- * Essentially the same.
- * Program files updated to include "readtex.c", not "../util/readtex.c".
- * * demos/reflect.c: Likewise for "showbuffer.c".
- *
- *
- * * Makefile.am (EXTRA_DIST): Added top-level regular files.
- *
- * * include/GL/Makefile.am (INC_X11): Added glxext.h.
- *
- *
- * * src/GGI/include/ggi/mesa/Makefile.am (EXTRA_HEADERS): Include
- * Mesa GGI headers in dist even if HAVE_GGI is not given.
- *
- * * configure.in: Look for GLUT and demo source dirs in $srcdir.
- *
- * * src/swrast/Makefile.am (libMesaSwrast_la_SOURCES): Set to *.[ch].
- * More source list updates in various Makefile.am's.
- *
- * * Makefile.am (dist-hook): Remove CVS directory from distribution.
- * (DIST_SUBDIRS): List all possible subdirs here.
- * (SUBDIRS): Only list subdirs selected for build again.
- * The above two applied to all subdir Makefile.am's also.
- *
- * Revision 1.4 2000/09/08 21:45:21 brianp
- * added dither key option
- *
- * Revision 1.3 1999/10/28 18:23:29 brianp
- * minor changes to Usage() function
- *
- * Revision 1.2 1999/10/21 22:13:58 brianp
- * added f key to toggle front/back drawing
- *
- * Revision 1.1.1.1 1999/08/19 00:55:40 jtg
- * Imported sources
- *
- * Revision 3.3 1999/03/28 18:18:33 brianp
- * minor clean-up
- *
- * Revision 3.2 1998/11/05 04:34:04 brianp
- * moved image files to ../images/ directory
- *
- * Revision 3.1 1998/02/22 16:43:17 brianp
- * added a few casts to silence compiler warnings
- *
- * Revision 3.0 1998/02/14 18:42:29 brianp
- * initial rev
- *
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <tickLib.h>
-
-#include <ugl/ugl.h>
-#include <ugl/uglucode.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-
-#include <GL/uglmesa.h>
-#include <GL/glu.h>
-
-#include "../util/readtex.h"
-
-#define IMAGE_FILE "Mesa/images/wrs_logo.rgb"
-
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL volatile UGL_BOOL stopWex;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-
-UGL_LOCAL int ImgWidth, ImgHeight;
-UGL_LOCAL GLenum ImgFormat;
-UGL_LOCAL GLubyte *Image;
-
-UGL_LOCAL int Xpos, Ypos;
-UGL_LOCAL int SkipPixels, SkipRows;
-UGL_LOCAL int DrawWidth, DrawHeight;
-UGL_LOCAL float Xzoom, Yzoom;
-UGL_LOCAL GLboolean Scissor;
-UGL_LOCAL GLboolean DrawFront;
-UGL_LOCAL GLboolean Dither;
-
-UGL_LOCAL void cleanUp (void);
-
-UGL_LOCAL void reset(void)
- {
- Xpos = Ypos = 20;
- DrawWidth = ImgWidth;
- DrawHeight = ImgHeight;
- SkipPixels = SkipRows = 0;
- Scissor = GL_FALSE;
- Xzoom = Yzoom = 1.0;
- }
-
-UGL_LOCAL void initGL(GLboolean ciMode, GLsizei width, GLsizei height)
- {
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
-
- Image = LoadRGBImage(IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat);
- if (!Image)
- {
- printf("Couldn't read %s\n", IMAGE_FILE);
- cleanUp();
- exit(1);
- }
-
- glScissor(width/4, height/4, width/2, height/2);
-
- if (ciMode)
- {
- /* Convert RGB image to grayscale */
- GLubyte *indexImage = malloc( ImgWidth * ImgHeight );
- GLint i;
- for (i=0; i<ImgWidth*ImgHeight; i++)
- {
- int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];
- indexImage[i] = gray / 3;
- }
- free(Image);
- Image = indexImage;
- ImgFormat = GL_COLOR_INDEX;
-
- for (i=0;i<255;i++)
- {
- float g = i / 255.0;
- uglMesaSetColor(i, g, g, g);
- }
- }
-
- printf("Loaded %d by %d image\n", ImgWidth, ImgHeight );
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth);
-
- reset();
-
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho( 0.0, width, 0.0, height, -1.0, 1.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- }
-
-UGL_LOCAL void drawGL(void)
- {
- glClear(GL_COLOR_BUFFER_BIT);
-
- /* This allows negative raster positions: */
- glRasterPos2i(0, 0);
- glBitmap(0, 0, 0, 0, Xpos, Ypos, NULL);
-
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, SkipPixels);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, SkipRows);
-
- glPixelZoom( Xzoom, Yzoom );
-
- if (Scissor)
- glEnable(GL_SCISSOR_TEST);
-
- glDrawPixels(DrawWidth, DrawHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
-
- glDisable(GL_SCISSOR_TEST);
-
- uglMesaSwapBuffers();
- }
-
-
-UGL_LOCAL void benchmark( void )
- {
- int startTick, endTick, ticksBySec;
- int draws;
- double seconds, pixelsPerSecond;
-
- printf("Benchmarking (4 sec)...\n");
-
- /* GL set-up */
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, SkipPixels);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, SkipRows);
- glPixelZoom( Xzoom, Yzoom );
- if (Scissor)
- glEnable(GL_SCISSOR_TEST);
-
- if (DrawFront)
- glDrawBuffer(GL_FRONT);
- else
- glDrawBuffer(GL_BACK);
-
- /* Run timing test */
- draws = 0;
-
- ticksBySec = sysClkRateGet ();
- startTick = tickGet();
-
- do {
- glDrawPixels(DrawWidth, DrawHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
- draws++;
- endTick = tickGet ();
- } while ((endTick - startTick)/ticksBySec < 4); /* 4 seconds */
-
- /* GL clean-up */
- glDisable(GL_SCISSOR_TEST);
-
- /* Results */
- seconds = (endTick - startTick)/ticksBySec;
- pixelsPerSecond = draws * DrawWidth * DrawHeight / seconds;
- printf("Result: %d draws in %f seconds = %f pixels/sec\n",
- draws, seconds, pixelsPerSecond);
- }
-
-UGL_LOCAL void echoUse(void)
- {
- printf("Keys:\n");
- printf(" SPACE Reset Parameters\n");
- printf(" Up/Down Move image up/down\n");
- printf(" Left/Right Move image left/right\n");
- printf(" x Decrease X-axis PixelZoom\n");
- printf(" X Increase X-axis PixelZoom\n");
- printf(" y Decrease Y-axis PixelZoom\n");
- printf(" Y Increase Y-axis PixelZoom\n");
- printf(" w Decrease glDrawPixels width*\n");
- printf(" W Increase glDrawPixels width*\n");
- printf(" h Decrease glDrawPixels height*\n");
- printf(" H Increase glDrawPixels height*\n");
- printf(" p Decrease GL_UNPACK_SKIP_PIXELS*\n");
- printf(" P Increase GL_UNPACK_SKIP_PIXELS*\n");
- printf(" r Decrease GL_UNPACK_SKIP_ROWS*\n");
- printf(" R Increase GL_UNPACK_SKIP_ROWS*\n");
- printf(" s Toggle GL_SCISSOR_TEST\n");
- printf(" f Toggle front/back buffer drawing\n");
- printf(" d Toggle dithering\n");
- printf(" b Benchmark test\n");
- printf(" ESC Exit\n");
- printf("* Warning: no limits are imposed on these parameters so it's\n");
- printf(" possible to cause a segfault if you go too far.\n");
- }
-
-
-UGL_LOCAL void readKey(UGL_WCHAR key)
- {
- switch (key)
- {
- case UGL_UNI_SPACE:
- reset();
- break;
- case 'd':
- Dither = !Dither;
- if (Dither)
- glEnable(GL_DITHER);
- else
- glDisable(GL_DITHER);
- break;
- case 'w':
- if (DrawWidth > 0)
- DrawWidth--;
- break;
- case 'W':
- DrawWidth++;
- break;
- case 'h':
- if (DrawHeight > 0)
- DrawHeight--;
- break;
- case 'H':
- DrawHeight++;
- break;
- case 'p':
- if (SkipPixels > 0)
- SkipPixels--;
- break;
- case 'P':
- SkipPixels++;
- break;
- case 'r':
- if (SkipRows > 0)
- SkipRows--;
- break;
- case 'R':
- SkipRows++;
- break;
- case 's':
- Scissor = !Scissor;
- break;
- case 'x':
- Xzoom -= 0.1;
- break;
- case 'X':
- Xzoom += 0.1;
- break;
- case 'y':
- Yzoom -= 0.1;
- break;
- case 'Y':
- Yzoom += 0.1;
- break;
- case 'b':
- benchmark();
- break;
- case 'f':
- DrawFront = !DrawFront;
- if (DrawFront)
- glDrawBuffer(GL_FRONT);
- else
- glDrawBuffer(GL_BACK);
- printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
- break;
- case UGL_UNI_UP_ARROW:
- Ypos += 1;
- break;
- case UGL_UNI_DOWN_ARROW:
- Ypos -= 1;
- break;
- case UGL_UNI_LEFT_ARROW:
- Xpos -= 1;
- break;
- case UGL_UNI_RIGHT_ARROW:
- Xpos += 1;
- break;
- case UGL_UNI_ESCAPE:
- stopWex = UGL_TRUE;
- break;
- }
- }
-
-UGL_LOCAL void loopEvent(void)
- {
- UGL_EVENT event;
- UGL_INPUT_EVENT * pInputEvent;
-
- UGL_FOREVER
- {
- if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
- != UGL_STATUS_Q_EMPTY)
- {
- pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
- pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- readKey(pInputEvent->type.keyboard.key);
- }
-
- drawGL();
- if (stopWex)
- break;
- }
- }
-
-UGL_LOCAL void cleanUp (void)
- {
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize ();
- }
-
-void windMLDrawPix (UGL_BOOL windMLMode);
-
-void ugldrawpix (void)
- {
- taskSpawn ("tDrawPix", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLDrawPix,
- UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLDrawPix (UGL_BOOL windMLMode)
- {
- UGL_INPUT_DEVICE_ID keyboardDevId;
- GLuint ciMode;
- GLsizei width, height;
-
- Image = NULL;
- Scissor = GL_FALSE;
- DrawFront = GL_FALSE;
- Dither = GL_TRUE;
-
- uglInitialize ();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0,
- (UGL_UINT32 *)&keyboardDevId);
-
- uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
-
- qId = uglEventQCreate (eventServiceId, 100);
-
- /* Double buffering */
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
-
- if (umc == NULL)
- {
- uglDeinitialize ();
- return;
- }
-
- uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
- UGL_MESA_FULLSCREEN_HEIGHT);
-
- uglMesaGetIntegerv(UGL_MESA_COLOR_INDEXED, &ciMode);
- uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
- uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
-
- initGL(ciMode, width, height);
-
- echoUse();
-
- stopWex = UGL_FALSE;
- loopEvent();
-
- cleanUp();
- free(Image);
-
- return;
- }
diff --git a/progs/windml/uglflip.c b/progs/windml/uglflip.c
deleted file mode 100644
index 0ca068f417d..00000000000
--- a/progs/windml/uglflip.c
+++ /dev/null
@@ -1,224 +0,0 @@
-
-/* uglflip.c - WindML/Mesa example program */
-
-/* Copyright (C) 2001 by Wind River Systems, Inc */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * The MIT License
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Authors:
- * Stephane Raimbault <[email protected]>
- */
-
-/*
-DESCRIPTION
-Draw a triangle and flip the screen
-*/
-
-#include <stdio.h>
-#include <math.h>
-
-#include <ugl/ugl.h>
-#include <ugl/uglucode.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-
-#include <GL/uglmesa.h>
-#include <GL/glu.h>
-
-#define BLACK (0)
-#define RED (1)
-#define GREEN (2)
-#define BLUE (3)
-#define CI_OFFSET 4
-
-UGL_LOCAL GLuint rgb;
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL volatile UGL_BOOL stopWex;
-
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-
-UGL_LOCAL void initGL (void)
- {
- uglMesaSetColor(BLACK, 0.0, 0.0, 0.0);
- uglMesaSetColor(RED, 1.0, 0.3, 0.3);
- uglMesaSetColor(GREEN, 0.3, 1.0, 0.3);
- uglMesaSetColor(BLUE, 0.3, 0.3, 1.0);
-
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClearIndex(BLACK);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- }
-
-UGL_LOCAL void drawGL (void)
- {
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- (rgb) ? glColor3f(1.0, 0.3, 0.3) : glIndexi(RED);
- glVertex2f(0.75, -0.50);
- (rgb) ? glColor3f(0.3, 1.0, 0.3) : glIndexi(GREEN);
- glVertex2f(0.0, 0.75);
- (rgb) ? glColor3f(0.3, 0.3, 1.0) : glIndexi(BLUE);
- glVertex2f(-0.75, -0.50);
- glEnd();
-
- glBegin(GL_LINES);
- (rgb) ? glColor3f(1.0, 0.3, 0.3) : glIndexi(RED);
- glVertex2f(-1.0, 1.0);
- (rgb) ? glColor3f(0.3, 0.3, 1.0) : glIndexi(BLUE);
- glVertex2f(1.0, -1.0);
- glEnd();
-
- glFlush();
-
- uglMesaSwapBuffers();
- }
-
-UGL_LOCAL void echoUse(void)
- {
- printf("tFlip keys:\n");
- printf(" d Toggle dithering\n");
- printf(" up Reduce the window\n");
- printf(" down Enlarge the window\n");
- printf(" page up Y==0 is the bottom line and increases upward\n");
- printf(" page down Y==0 is the bottom line and increases downward\n");
- printf(" ESC Exit\n");
- }
-
-UGL_LOCAL void readKey (UGL_WCHAR key)
- {
-
- switch(key)
- {
- case UGL_UNI_UP_ARROW:
- uglMesaResizeWindow(8, 8);
- break;
- case UGL_UNI_DOWN_ARROW:
- glDrawBuffer(GL_FRONT_LEFT);
- glClear(GL_COLOR_BUFFER_BIT);
- glDrawBuffer(GL_BACK_LEFT);
- uglMesaResizeWindow(-8, -8);
- break;
- case UGL_UNI_PAGE_UP:
- uglMesaPixelStore(UGL_MESA_Y_UP, GL_TRUE);
- break;
- case UGL_UNI_PAGE_DOWN:
- uglMesaPixelStore(UGL_MESA_Y_UP, GL_FALSE);
- break;
- case UGL_UNI_ESCAPE:
- stopWex = UGL_TRUE;
- break;
- case 'd':
- if (glIsEnabled(GL_DITHER))
- glDisable(GL_DITHER);
- else
- glEnable(GL_DITHER);
- break;
- }
- }
-
-UGL_LOCAL void loopEvent(void)
- {
- UGL_EVENT event;
- UGL_INPUT_EVENT * pInputEvent;
-
- drawGL();
-
- UGL_FOREVER
- {
- if (uglEventGet (qId, &event, sizeof (event), UGL_WAIT_FOREVER)
- != UGL_STATUS_Q_EMPTY)
- {
- pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
- pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- {
- readKey(pInputEvent->type.keyboard.key);
- drawGL();
- }
- }
-
- if (stopWex)
- break;
- }
- }
-
-void windMLFlip (UGL_BOOL windMLMode);
-
-void uglflip (void)
- {
- taskSpawn ("tFlip", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLFlip,
- UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLFlip (UGL_BOOL windMLMode)
- {
-
- UGL_INPUT_DEVICE_ID keyboardDevId;
-
- uglInitialize();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
-
- uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
-
- qId = uglEventQCreate (eventServiceId, 100);
-
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_SINGLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE_SOFTWARE, NULL);
-
- if (umc == NULL)
- {
- uglDeinitialize();
- return;
- }
-
- uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
- UGL_MESA_FULLSCREEN_HEIGHT);
-
- uglMesaGetIntegerv(UGL_MESA_RGB, &rgb);
-
- initGL();
-
- echoUse();
- stopWex = UGL_FALSE;
- loopEvent();
-
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize();
-
- return;
- }
diff --git a/progs/windml/uglgears.c b/progs/windml/uglgears.c
deleted file mode 100644
index 468fe899806..00000000000
--- a/progs/windml/uglgears.c
+++ /dev/null
@@ -1,428 +0,0 @@
-
-/* uglgears.c - WindML/Mesa example program */
-
-/*
- * 3-D gear wheels. This program is in the public domain.
- *
- * Brian Paul
- *
- * Conversion to GLUT by Mark J. Kilgard
- * Conversion to UGL/Mesa from GLUT by Stephane Raimbault
- */
-
-/*
-DESCRIPTION
-Spinning gears demo
-*/
-
-#include <stdio.h>
-#include <math.h>
-#include <tickLib.h>
-
-#include <ugl/ugl.h>
-#include <ugl/uglucode.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-#include <GL/uglmesa.h>
-#include <GL/glu.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#define COUNT_FRAMES
-
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL volatile UGL_BOOL stopWex;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-
-UGL_LOCAL GLfloat view_rotx, view_roty, view_rotz;
-UGL_LOCAL GLint gear1, gear2, gear3;
-UGL_LOCAL GLfloat angle;
-
-UGL_LOCAL GLuint limit;
-UGL_LOCAL GLuint count;
-UGL_LOCAL GLuint tickStart, tickStop, tickBySec;
-
-
-/*
-* Draw a gear wheel. You'll probably want to call this function when
-* building a display list since we do a lot of trig here.
-*
-* Input: inner_radius - radius of hole at center
-* outer_radius - radius at center of teeth
-* width - width of gear
-* teeth - number of teeth
-* tooth_depth - depth of tooth
-*/
-
-UGL_LOCAL void gear
- (
- GLfloat inner_radius,
- GLfloat outer_radius,
- GLfloat width,
- GLint teeth,
- GLfloat tooth_depth
- )
- {
- GLint i;
- GLfloat r0, r1, r2;
- GLfloat angle, da;
- GLfloat u, v, len;
-
- r0 = inner_radius;
- r1 = outer_radius - tooth_depth/2.0;
- r2 = outer_radius + tooth_depth/2.0;
-
- da = 2.0*M_PI / teeth / 4.0;
-
- glShadeModel (GL_FLAT);
-
- glNormal3f (0.0, 0.0, 1.0);
-
- /* draw front face */
- glBegin (GL_QUAD_STRIP);
- for (i=0;i<=teeth;i++)
- {
- angle = i * 2.0*M_PI / teeth;
- glVertex3f (r0*cos (angle), r0*sin (angle), width*0.5);
- glVertex3f (r1*cos (angle), r1*sin (angle), width*0.5);
- glVertex3f (r0*cos (angle), r0*sin (angle), width*0.5);
- glVertex3f (r1*cos (angle+3*da), r1*sin (angle+3*da), width*0.5);
- }
- glEnd ();
-
- /* draw front sides of teeth */
- glBegin (GL_QUADS);
- da = 2.0*M_PI / teeth / 4.0;
- for (i=0; i<teeth; i++)
- {
- angle = i * 2.0*M_PI / teeth;
-
- glVertex3f (r1*cos (angle), r1*sin (angle), width*0.5);
- glVertex3f (r2*cos (angle+da), r2*sin (angle+da), width*0.5);
- glVertex3f (r2*cos (angle+2*da), r2*sin (angle+2*da), width*0.5);
- glVertex3f (r1*cos (angle+3*da), r1*sin (angle+3*da), width*0.5);
- }
- glEnd ();
-
-
- glNormal3f (0.0, 0.0, -1.0);
-
- /* draw back face */
- glBegin (GL_QUAD_STRIP);
- for (i=0; i<=teeth ;i++)
- {
- angle = i * 2.0*M_PI / teeth;
- glVertex3f (r1*cos (angle), r1*sin (angle), -width*0.5);
- glVertex3f (r0*cos (angle), r0*sin (angle), -width*0.5);
- glVertex3f (r1*cos (angle+3*da), r1*sin (angle+3*da), -width*0.5);
- glVertex3f (r0*cos (angle), r0*sin (angle), -width*0.5);
- }
- glEnd ();
-
- /* draw back sides of teeth */
- glBegin (GL_QUADS);
- da = 2.0*M_PI / teeth / 4.0;
- for (i=0;i<teeth;i++)
- {
- angle = i * 2.0*M_PI / teeth;
-
- glVertex3f (r1*cos (angle+3*da), r1*sin (angle+3*da), -width*0.5);
- glVertex3f (r2*cos (angle+2*da), r2*sin (angle+2*da), -width*0.5);
- glVertex3f (r2*cos (angle+da), r2*sin (angle+da), -width*0.5);
- glVertex3f (r1*cos (angle), r1*sin (angle), -width*0.5);
- }
- glEnd ();
-
-
- /* draw outward faces of teeth */
- glBegin (GL_QUAD_STRIP);
- for (i=0;i<teeth;i++)
- {
- angle = i * 2.0*M_PI / teeth;
-
- glVertex3f (r1*cos (angle), r1*sin (angle), width*0.5);
- glVertex3f (r1*cos (angle), r1*sin (angle), -width*0.5);
- u = r2*cos (angle+da) - r1*cos (angle);
- v = r2*sin (angle+da) - r1*sin (angle);
- len = sqrt (u*u + v*v);
- u /= len;
- v /= len;
- glNormal3f (v, -u, 0.0);
- glVertex3f (r2*cos (angle+da), r2*sin (angle+da), width*0.5);
- glVertex3f (r2*cos (angle+da), r2*sin (angle+da), -width*0.5);
- glNormal3f (cos (angle), sin (angle), 0.0);
- glVertex3f (r2*cos (angle+2*da), r2*sin (angle+2*da), width*0.5);
- glVertex3f (r2*cos (angle+2*da), r2*sin (angle+2*da), -width*0.5);
- u = r1*cos (angle+3*da) - r2*cos (angle+2*da);
- v = r1*sin (angle+3*da) - r2*sin (angle+2*da);
- glNormal3f (v, -u, 0.0);
- glVertex3f (r1*cos (angle+3*da), r1*sin (angle+3*da), width*0.5);
- glVertex3f (r1*cos (angle+3*da), r1*sin (angle+3*da), -width*0.5);
- glNormal3f (cos (angle), sin (angle), 0.0);
- }
-
- glVertex3f (r1*cos (0), r1*sin (0), width*0.5);
- glVertex3f (r1*cos (0), r1*sin (0), -width*0.5);
-
- glEnd ();
-
- glShadeModel (GL_SMOOTH);
-
- /* draw inside radius cylinder */
- glBegin (GL_QUAD_STRIP);
- for (i=0;i<=teeth;i++)
- {
- angle = i * 2.0*M_PI / teeth;
- glNormal3f (-cos (angle), -sin (angle), 0.0);
- glVertex3f (r0*cos (angle), r0*sin (angle), -width*0.5);
- glVertex3f (r0*cos (angle), r0*sin (angle), width*0.5);
- }
- glEnd ();
-
-}
-
-UGL_LOCAL void drawGL (void)
- {
-#ifdef COUNT_FRAMES
- int time;
-#endif
-
- angle += 2.0;
-
- glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix ();
- glRotatef (view_rotx, 1.0, 0.0, 0.0);
- glRotatef (view_roty, 0.0, 1.0, 0.0);
- glRotatef (view_rotz, 0.0, 0.0, 1.0);
-
- glPushMatrix ();
- glTranslatef (-3.0, -2.0, 0.0);
- glRotatef (angle, 0.0, 0.0, 1.0);
- glCallList (gear1);
- glPopMatrix ();
-
- glPushMatrix ();
- glTranslatef (3.1, -2.0, 0.0);
- glRotatef (-2.0*angle-9.0, 0.0, 0.0, 1.0);
- glCallList (gear2);
- glPopMatrix ();
-
- glPushMatrix ();
- glTranslatef (-3.1, 4.2, 0.0);
- glRotatef (-2.0*angle-25.0, 0.0, 0.0, 1.0);
- glCallList (gear3);
- glPopMatrix ();
-
- glPopMatrix ();
-
- glFlush();
-
- uglMesaSwapBuffers ();
-
-#ifdef COUNT_FRAMES
- if (count > limit)
- {
- tickStop = tickGet ();
- time = (tickStop-tickStart)/tickBySec;
- printf (" %i fps\n", count/time);
- tickStart = tickStop;
- count = 0;
- }
- else
- count++;
-#endif
-}
-
-
-UGL_LOCAL void initGL (GLsizei width, GLsizei height)
- {
- UGL_LOCAL GLfloat pos[4] = {5.0, 5.0, 10.0, 1.0 };
- UGL_LOCAL GLfloat red[4] = {0.8, 0.1, 0.0, 1.0 };
- UGL_LOCAL GLfloat green[4] = {0.0, 0.8, 0.2, 1.0 };
- UGL_LOCAL GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0 };
-
- glLightfv (GL_LIGHT0, GL_POSITION, pos);
- glEnable (GL_CULL_FACE);
- glEnable (GL_LIGHTING);
- glEnable (GL_LIGHT0);
- glEnable (GL_DEPTH_TEST);
-
- /* make the gears */
- gear1 = glGenLists (1);
- glNewList (gear1, GL_COMPILE);
- glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
- gear (1.0, 4.0, 1.0, 20, 0.7);
- glEndList ();
-
- gear2 = glGenLists (1);
- glNewList (gear2, GL_COMPILE);
- glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
- gear (0.5, 2.0, 2.0, 10, 0.7);
- glEndList ();
-
- gear3 = glGenLists (1);
- glNewList (gear3, GL_COMPILE);
- glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
- gear (1.3, 2.0, 0.5, 10, 0.7);
- glEndList ();
-
- glEnable (GL_NORMALIZE);
-
- glViewport (0, 0, width, height);
-
- glMatrixMode (GL_PROJECTION);
- glLoadIdentity ();
- if (width>height)
- {
- GLfloat w = (GLfloat) width / (GLfloat) height;
- glFrustum (-w, w, -1.0, 1.0, 5.0, 60.0);
- }
- else
- {
- GLfloat h = (GLfloat) height / (GLfloat) width;
- glFrustum (-1.0, 1.0, -h, h, 5.0, 60.0);
- }
-
- glMatrixMode (GL_MODELVIEW);
- glLoadIdentity ();
- glTranslatef (0.0, 0.0, -40.0);
-
-#ifdef COUNT_FRAMES
- tickStart = tickGet ();
- tickBySec = sysClkRateGet ();
-#endif
-}
-
-UGL_LOCAL void echoUse(void)
- {
- printf("tGears keys:\n");
- printf(" z Counter clockwise rotation (z-axis)\n");
- printf(" Z Clockwise rotation (z-axis)\n");
- printf(" Up Counter clockwise rotation (x-axis)\n");
- printf(" Down Clockwise rotation (x-axis)\n");
- printf(" Left Counter clockwise rotation (y-axis)\n");
- printf(" Right Clockwise rotation (y-axis)\n");
- printf(" ESC Exit\n");
- }
-
-
-UGL_LOCAL void readKey (UGL_WCHAR key)
- {
-
- switch(key)
- {
- case 'z':
- view_rotz += 5.0;
- break;
- case 'Z':
- view_rotz -= 5.0;
- break;
- case UGL_UNI_UP_ARROW:
- view_rotx += 5.0;
- break;
- case UGL_UNI_DOWN_ARROW:
- view_rotx -= 5.0;
- break;
- case UGL_UNI_LEFT_ARROW:
- view_roty += 5.0;
- break;
- case UGL_UNI_RIGHT_ARROW:
- view_roty -= 5.0;
- break;
- case UGL_UNI_ESCAPE:
- stopWex = UGL_TRUE;
- break;
- }
- }
-
-UGL_LOCAL void loopEvent(void)
- {
- UGL_EVENT event;
- UGL_INPUT_EVENT * pInputEvent;
-
- UGL_FOREVER
- {
- if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
- != UGL_STATUS_Q_EMPTY)
- {
- pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
- pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- readKey(pInputEvent->type.keyboard.key);
- }
-
- drawGL();
- if (stopWex)
- break;
- }
- }
-
-void windMLGears (UGL_BOOL windMLMode);
-
-void uglgears (void)
- {
- taskSpawn ("tGears", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLGears,
- UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLGears (UGL_BOOL windMLMode)
- {
- GLsizei width, height;
- UGL_INPUT_DEVICE_ID keyboardDevId;
-
- view_rotx=20.0;
- view_roty=30.0;
- view_rotz=0.0;
- angle = 0.0;
- limit = 100;
- count = 1;
-
- uglInitialize ();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0,
- (UGL_UINT32 *)&keyboardDevId);
-
- uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
-
- qId = uglEventQCreate (eventServiceId, 100);
-
- /* Double buffering */
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
-
- if (umc == NULL)
- {
- uglDeinitialize ();
- return;
- }
-
- /* Fullscreen */
-
- uglMesaMakeCurrentContext (umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
- UGL_MESA_FULLSCREEN_HEIGHT);
-
- uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
- uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
-
- initGL (width, height);
-
- echoUse();
-
- stopWex = UGL_FALSE;
- loopEvent();
-
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize ();
-
- return;
- }
diff --git a/progs/windml/uglicotorus.c b/progs/windml/uglicotorus.c
deleted file mode 100644
index c09b6d1b520..00000000000
--- a/progs/windml/uglicotorus.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/* uglicotorus.c - WindML/Mesa example program */
-
-/* Copyright (C) 2001 by Wind River Systems, Inc */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * The MIT License
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
-modification history
---------------------
-01a,jun01,sra
-*/
-
-#include <stdio.h>
-#include <math.h>
-
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-#include <ugl/uglucode.h>
-
-#include <GL/uglmesa.h>
-#include <GL/glu.h>
-
-/* Need GLUT_SHAPES */
-
-#include <GL/uglglutshapes.h>
-
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-UGL_LOCAL volatile UGL_BOOL stopWex;
-
-UGL_LOCAL GLfloat angle;
-UGL_LOCAL GLboolean chaos_on;
-UGL_LOCAL GLboolean color_on;
-
-UGL_LOCAL GLuint theIco, theTorus, theSphere, theCube;
-
-UGL_LOCAL void initGL
- (
- int w,
- int h
- )
- {
- glViewport(0,0,(GLsizei)w,(GLsizei)h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(60.0,(GLfloat)w/(GLfloat)h,1.0,60.0);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- gluLookAt(0.0,0.0,25.0,0.0,0.0,0.0,0.0,1.0,0.0);
-
- glClearColor(0.0,0.0,0.0,0.0);
-
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
-
- glEnable(GL_COLOR_MATERIAL);
-
- theIco = glGenLists(1);
- glNewList(theIco, GL_COMPILE);
- glutSolidIcosahedron();
- glEndList();
-
- theTorus = glGenLists(1);
- glNewList(theTorus, GL_COMPILE);
- glutSolidTorus(0.2,1.0,10,10);
- glEndList();
-
- theSphere = glGenLists(1);
- glNewList(theSphere, GL_COMPILE);
- glutSolidSphere(2.5,20,20);
- glEndList();
-
- theCube = glGenLists(1);
- glNewList(theCube, GL_COMPILE);
- glutSolidCube(4.0);
- glEndList();
-
- }
-
-UGL_LOCAL void createIcoToruses
- (
- int i
- )
- {
- glPushMatrix();
- glRotatef(angle,1.0,1.0,1.0);
- glCallList(theIco);
-
- switch (i)
- {
- case 9 :
- glColor3f(1.0,0.0,0.0);
- break;
- case 0 :
- glColor3f(1.0,0.1,0.7);
- break;
- case 1 :
- glColor3f(1.0,0.0,1.0);
- break;
- case 2 :
- glColor3f(0.0,0.0,1.0);
- break;
- case 3 :
- glColor3f(0.0,0.5,1.0);
- break;
- case 4 :
- glColor3f(0.0,1.0,0.7);
- break;
- case 5 :
- glColor3f(0.0,1.0,0.0);
- break;
- case 6 :
- glColor3f(0.5,1.0,0.0);
- break;
- case 7 :
- glColor3f(1.0,1.0,0.0);
- break;
- case 8 :
- glColor3f(1.0,0.5,0.0);
- break;
- }
-
- glRotatef(angle,1.0,1.0,1.0);
- glCallList(theTorus);
- glRotatef(-2*angle,1.0,1.0,1.0);
- glCallList(theTorus);
- glPopMatrix();
- }
-
-UGL_LOCAL void drawGL (void)
- {
- int i;
-
- if (color_on)
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- else
- glClear(GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix();
-
- if (chaos_on)
- glRotatef(angle,1.0,1.0,1.0);
-
- glPushMatrix();
- glRotatef(angle,1.0,1.0,1.0);
- glColor3f(1.0,0.5,0.0);
- glCallList(theSphere);
- glColor3f(1.0,0.0,0.0);
- glCallList(theCube);
- glPopMatrix();
-
- glRotatef(-angle,0.0,0.0,1.0);
- glPushMatrix();
- /* draw ten icosahedrons */
- for (i = 0; i < 10; i++)
- {
- glPushMatrix();
- glRotatef(36*i,0.0,0.0,1.0);
- glTranslatef(10.0,0.0,0.0);
- glRotatef(2*angle,0.0,1.0,0.0);
- glTranslatef(0.0,0.0,2.0);
-
- createIcoToruses(i);
- glPopMatrix();
- }
- glPopMatrix();
-
- glPopMatrix();
-
- uglMesaSwapBuffers();
-
- angle += 1.0;
-
- }
-
-UGL_LOCAL void echoUse(void)
- {
- printf("tIcoTorus keys:\n");
- printf(" c Toggle color buffer clear\n");
- printf(" SPACE Toggle chaos mode\n");
- printf(" ESC Exit\n");
- }
-
-UGL_LOCAL void readKey (UGL_WCHAR key)
- {
-
- switch(key)
- {
- case 'c':
- color_on = !color_on;
- break;
- case UGL_UNI_SPACE:
- chaos_on = !chaos_on;
- break;
- case UGL_UNI_ESCAPE:
- stopWex = UGL_TRUE;
- break;
- }
- }
-
-UGL_LOCAL void loopEvent(void)
- {
- UGL_EVENT event;
- UGL_INPUT_EVENT * pInputEvent;
-
- UGL_FOREVER
- {
- if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
- != UGL_STATUS_Q_EMPTY)
- {
- pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
- pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- readKey(pInputEvent->type.keyboard.key);
- }
-
- drawGL();
- if (stopWex)
- break;
- }
- }
-
-void windMLIcoTorus (UGL_BOOL windMLMode);
-
-void uglicotorus (void)
- {
- taskSpawn ("tIcoTorus", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLIcoTorus,
- UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLIcoTorus (UGL_BOOL windMLMode)
- {
- GLsizei width, height;
- UGL_INPUT_DEVICE_ID keyboardDevId;
-
- angle = 0.0;
- chaos_on = GL_TRUE;
- color_on = GL_TRUE;
-
- uglInitialize ();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0,
- (UGL_UINT32 *)&keyboardDevId);
-
- if (uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0,
- (UGL_UINT32 *)&eventServiceId) == UGL_STATUS_OK)
- {
- qId = uglEventQCreate (eventServiceId, 100);
- }
- else
- {
- eventServiceId = UGL_NULL;
- }
-
- /* Double buffering */
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
-
- if (umc == NULL)
- {
- uglDeinitialize ();
- return;
- }
-
- uglMesaMakeCurrentContext (umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
- UGL_MESA_FULLSCREEN_HEIGHT);
-
- uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
- uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
-
- initGL (width, height);
-
- echoUse();
-
- stopWex = UGL_FALSE;
- loopEvent();
-
- if (eventServiceId != UGL_NULL)
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext ();
- uglDeinitialize ();
-
- return;
- }
-
diff --git a/progs/windml/uglline.c b/progs/windml/uglline.c
deleted file mode 100644
index e58f071ea4b..00000000000
--- a/progs/windml/uglline.c
+++ /dev/null
@@ -1,274 +0,0 @@
-
-/* uglline.c - WindML/Mesa example program */
-
-/*
- * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that (i) the above copyright notices and this permission notice appear in
- * all copies of the software and related documentation, and (ii) the name of
- * Silicon Graphics may not be used in any advertising or
- * publicity relating to the software without the specific, prior written
- * permission of Silicon Graphics.
- *
- * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
- * ANY KIND,
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- *
- * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
- * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
- * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
- * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-/*
-modification history
---------------------
-01a,jun01,sra Ported to UGL/Mesa and modifications
-*/
-
-/*
-DESCRIPTION
-Draw circular lines
-*/
-
-#include <stdio.h>
-#include <math.h>
-
-#include <ugl/ugl.h>
-#include <ugl/uglucode.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-
-#include <GL/uglmesa.h>
-#include <GL/glu.h>
-
-#define BLACK (0)
-#define YELLOW (1)
-#define GREEN (2)
-#define BLUE (3)
-#define CI_OFFSET 4
-
-UGL_LOCAL GLuint rgb;
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL volatile UGL_BOOL stopWex;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-
-UGL_LOCAL GLboolean mode1, mode2;
-UGL_LOCAL GLint size;
-
-UGL_LOCAL GLfloat pntA[3] = {
- -10.0, 0.0, 0.0
-};
-UGL_LOCAL GLfloat pntB[3] = {
- -5.0, 0.0, 0.0
-};
-
-UGL_LOCAL GLint angleA;
-
-UGL_LOCAL void initGL (void)
- {
- GLint i;
-
- uglMesaSetColor(BLACK, 0.0, 0.0, 0.0);
- uglMesaSetColor(YELLOW, 1.0, 1.0, 0.0);
- uglMesaSetColor(GREEN, 0.0, 1.0, 0.0);
- uglMesaSetColor(BLUE, 0.0, 0.0, 1.0);
-
- for (i = 0; i < 16; i++)
- {
- uglMesaSetColor(CI_OFFSET+i, i/15.0, i/15.0, 0.0);
- }
-
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClearIndex(BLACK);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-10, 10, -10, 10, -10.0, 10.0);
-
- glMatrixMode(GL_MODELVIEW);
-
- glLineStipple(1, 0xF0E0);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
-
- mode1 = GL_FALSE;
- mode2 = GL_FALSE;
- size = 1;
- }
-
-UGL_LOCAL void drawGL (void)
- {
-
- GLint ci, i;
-
- glClear(GL_COLOR_BUFFER_BIT);
-
- glLineWidth(size);
-
- if (mode1) {
- glEnable(GL_LINE_STIPPLE);
- } else {
- glDisable(GL_LINE_STIPPLE);
- }
-
- if (mode2) {
- ci = CI_OFFSET;
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
- } else {
- ci = YELLOW;
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_BLEND);
- }
-
- glPushMatrix();
-
- glRotatef(angleA, 1, 0, 1);
- angleA = angleA++ % 360;
-
- for (i = 0; i < 360; i += 5) {
- glRotatef(5.0, 0, 0, 1);
-
- glColor3f(1.0, 1.0, 0.0);
- glBegin(GL_LINE_STRIP);
- glVertex3fv(pntA);
- glVertex3fv(pntB);
- glEnd();
-
- glPointSize(1);
-
- glColor3f(0.0, 1.0, 0.0);
- glBegin(GL_POINTS);
- glVertex3fv(pntA);
- glVertex3fv(pntB);
- glEnd();
- }
-
- glPopMatrix();
-
- glFlush();
-
- uglMesaSwapBuffers();
-
- }
-
-UGL_LOCAL void echoUse(void)
- {
- printf("tLine keys:\n");
- printf(" b Blending/antialiasing\n");
- printf(" n Line stipple\n");
- printf(" Up/Down Pixel size\n");
- printf(" ESC Exit\n");
- }
-
-UGL_LOCAL void readKey (UGL_WCHAR key)
- {
- switch(key)
- {
- case 'n':
- mode1 = (mode1) ? GL_FALSE: GL_TRUE;
- break;
- case 'b':
- mode2 = (mode2) ? GL_FALSE: GL_TRUE;
- break;
- case UGL_UNI_DOWN_ARROW:
- if(size>0)
- size--;
- break;
- case UGL_UNI_UP_ARROW:
- size++;
- break;
- case UGL_UNI_ESCAPE:
- stopWex = UGL_TRUE;
- break;
- }
- }
-
-UGL_LOCAL void loopEvent(void)
- {
- UGL_EVENT event;
- UGL_INPUT_EVENT * pInputEvent;
-
- UGL_FOREVER
- {
- if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
- != UGL_STATUS_Q_EMPTY)
- {
- pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
- pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- readKey(pInputEvent->type.keyboard.key);
- }
-
- drawGL();
- if (stopWex)
- break;
- }
- }
-
-void windMLLine (UGL_BOOL windMLMode);
-
-void uglline (void)
- {
- taskSpawn("tLine", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLLine,
- UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-
-void windMLLine(UGL_BOOL windMLMode)
- {
-
- UGL_INPUT_DEVICE_ID keyboardDevId;
-
- angleA = 0;
-
- uglInitialize();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
-
- uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
-
- qId = uglEventQCreate (eventServiceId, 100);
-
- /* Double buffer */
-
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
-
- if (umc == NULL)
- {
- uglDeinitialize();
- return;
- }
-
- /* Fullscreen */
-
- uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
- UGL_MESA_FULLSCREEN_HEIGHT);
-
- uglMesaGetIntegerv(UGL_MESA_RGB, &rgb);
-
- initGL();
-
- echoUse();
-
- stopWex = UGL_FALSE;
- loopEvent();
-
- uglEventQDestroy(eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize();
-
- return;
- }
diff --git a/progs/windml/uglolympic.c b/progs/windml/uglolympic.c
deleted file mode 100644
index 282558dacbd..00000000000
--- a/progs/windml/uglolympic.c
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that (i) the above copyright notices and this permission notice appear in
- * all copies of the software and related documentation, and (ii) the name of
- * Silicon Graphics may not be used in any advertising or
- * publicity relating to the software without the specific, prior written
- * permission of Silicon Graphics.
- *
- * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
- * ANY KIND,
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- *
- * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
- * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
- * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
- * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-/*
- * Nov 20, 1995 use stdlib's rand()/srand() instead of random()/srand48(), etc.
- */
-
-/*
- * Modified by Stephane Raimbault to be able to run in VxWorks 07/18/01
- *
- * Modified by Li Wei([email protected]) to be able to run in Windows
- * 6/13
- *
- * Modified by Brian Paul to compile with Windows OR Unix. 7/23/97
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include <ugl/ugl.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-#include <ugl/uglucode.h>
-
-#include <GL/uglmesa.h>
-#include <GL/glu.h>
-
-#ifndef RAND_MAX
-# define RAND_MAX 32767
-#endif
-
-#define XSIZE 100
-#define YSIZE 75
-
-#define RINGS 5
-#define BLUERING 0
-#define BLACKRING 1
-#define REDRING 2
-#define YELLOWRING 3
-#define GREENRING 4
-
-#define BACKGROUND 8
-
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-UGL_LOCAL volatile UGL_BOOL stopWex;
-
-UGL_LOCAL int rgb;
-UGL_LOCAL unsigned char rgb_colors[RINGS][3];
-UGL_LOCAL int mapped_colors[RINGS];
-UGL_LOCAL float dests[RINGS][3];
-UGL_LOCAL float offsets[RINGS][3];
-UGL_LOCAL float angs[RINGS];
-UGL_LOCAL float rotAxis[RINGS][3];
-UGL_LOCAL int iters[RINGS];
-UGL_LOCAL GLuint theTorus;
-
-enum {
- COLOR_BLACK = 0,
- COLOR_RED,
- COLOR_GREEN,
- COLOR_YELLOW,
- COLOR_BLUE,
- COLOR_MAGENTA,
- COLOR_CYAN,
- COLOR_WHITE
-};
-
-/*
-UGL_LOCAL float RGBMap[9][3] = {
- {0, 0, 0},
- {1, 0, 0},
- {0, 1, 0},
- {1, 1, 0},
- {0, 0, 1},
- {1, 0, 1},
- {0, 1, 1},
- {1, 1, 1},
- {0.5, 0.5, 0.5}
-};
-
-UGL_LOCAL void SetColor(int c)
- {
- (rgb) ? glColor3fv(RGBMap[c]): glIndexf(c);
- }
-
-UGL_LOCAL void InitMap(void)
- {
- int i;
-
- if (rgb)
- return;
-
- for (i = 0; i < 9; i++)
- uglMesaSetColor(i, RGBMap[i][0], RGBMap[i][1], RGBMap[i][2]);
- }
-
-UGL_LOCAL void SetFogRamp(int density, int startIndex)
- {
- int fogValues, colorValues;
- int i, j, k;
- float intensity;
-
- fogValues = 1 << density;
- colorValues = 1 << startIndex;
- for (i = 0; i < colorValues; i++)
- {
- for (j = 0; j < fogValues; j++)
- {
- k = i * fogValues + j;
- intensity = (i * fogValues + j * colorValues) / 255.0;
- uglMesaSetColor(k, intensity, intensity, intensity);
- }
- }
- }
-
-UGL_LOCAL void SetGreyRamp(void)
- {
- int i;
- float intensity;
-
- for (i = 0; i < 255; i++)
- {
- intensity = i / 255.0;
- uglMesaSetColor(i, intensity, intensity, intensity);
- }
- }
-*/
-
-UGL_LOCAL void FillTorus(float rc, int numc, float rt, int numt)
- {
- int i, j, k;
- double s, t;
- double x, y, z;
- double pi, twopi;
-
- pi = 3.14159265358979323846;
- twopi = 2 * pi;
-
- for (i = 0; i < numc; i++)
- {
- glBegin(GL_QUAD_STRIP);
- for (j = 0; j <= numt; j++)
- {
- for (k = 1; k >= 0; k--)
- {
- s = (i + k) % numc + 0.5;
- t = j % numt;
-
- x = cos(t*twopi/numt) * cos(s*twopi/numc);
- y = sin(t*twopi/numt) * cos(s*twopi/numc);
- z = sin(s*twopi/numc);
- glNormal3f(x, y, z);
-
- x = (rt + rc * cos(s*twopi/numc)) * cos(t*twopi/numt);
- y = (rt + rc * cos(s*twopi/numc)) * sin(t*twopi/numt);
- z = rc * sin(s*twopi/numc);
- glVertex3f(x, y, z);
- }
- }
- glEnd();
- }
- }
-
-UGL_LOCAL float Clamp(int iters_left, float t)
- {
- if (iters_left < 3)
- {
- return 0.0;
- }
- return (iters_left-2)*t/iters_left;
- }
-
-UGL_LOCAL void drawGL(void)
- {
- int i, j;
-
- for (i = 0; i < RINGS; i++)
- {
- if (iters[i]) {
- for (j = 0; j < 3; j++)
- {
- offsets[i][j] = Clamp(iters[i], offsets[i][j]);
- }
- angs[i] = Clamp(iters[i], angs[i]);
- iters[i]--;
- }
- }
-
- glPushMatrix();
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- gluLookAt(0,0,10, 0,0,0, 0,1,0);
-
- for (i = 0; i < RINGS; i++)
- {
- if (rgb)
- {
- glColor3ubv(rgb_colors[i]);
- }
- else
- {
- glIndexi(mapped_colors[i]);
- }
- glPushMatrix();
- glTranslatef(dests[i][0]+offsets[i][0], dests[i][1]+offsets[i][1],
- dests[i][2]+offsets[i][2]);
- glRotatef(angs[i], rotAxis[i][0], rotAxis[i][1], rotAxis[i][2]);
- glCallList(theTorus);
- glPopMatrix();
- }
-
- glPopMatrix();
-
- glFlush();
-
- uglMesaSwapBuffers();
- }
-
-UGL_LOCAL float MyRand(void)
- {
- return 10.0 * ( (float) rand() / (float) RAND_MAX - 0.5 );
- }
-
-UGL_LOCAL void ReInit(void)
- {
- int i;
- float deviation;
-
- deviation = MyRand() / 2;
- deviation = deviation * deviation;
- for (i = 0; i < RINGS; i++)
- {
- offsets[i][0] = MyRand();
- offsets[i][1] = MyRand();
- offsets[i][2] = MyRand();
- angs[i] = 260.0 * MyRand();
- rotAxis[i][0] = MyRand();
- rotAxis[i][1] = MyRand();
- rotAxis[i][2] = MyRand();
- iters[i] = (deviation * MyRand() + 60.0);
- }
- }
-
-UGL_LOCAL void initGL(void)
- {
- float base, height;
- float aspect, x, y;
- int i;
-
- float top_y = 1.0;
- float bottom_y = 0.0;
- float top_z = 0.15;
- float bottom_z = 0.69;
- float spacing = 2.5;
- static float lmodel_ambient[] = {0.0, 0.0, 0.0, 0.0};
- static float lmodel_twoside[] = {GL_FALSE};
- static float lmodel_local[] = {GL_FALSE};
- static float light0_ambient[] = {0.1, 0.1, 0.1, 1.0};
- static float light0_diffuse[] = {1.0, 1.0, 1.0, 0.0};
- static float light0_position[] = {0.8660254, 0.5, 1, 0};
- static float light0_specular[] = {1.0, 1.0, 1.0, 0.0};
- static float bevel_mat_ambient[] = {0.0, 0.0, 0.0, 1.0};
- static float bevel_mat_shininess[] = {40.0};
- static float bevel_mat_specular[] = {1.0, 1.0, 1.0, 0.0};
- static float bevel_mat_diffuse[] = {1.0, 0.0, 0.0, 0.0};
-
- ReInit();
-
- for (i = 0; i < RINGS; i++)
- {
- rgb_colors[i][0] = rgb_colors[i][1] = rgb_colors[i][2] = 0;
- }
- rgb_colors[BLUERING][2] = 255;
- rgb_colors[REDRING][0] = 255;
- rgb_colors[GREENRING][1] = 255;
- rgb_colors[YELLOWRING][0] = 255;
- rgb_colors[YELLOWRING][1] = 255;
- mapped_colors[BLUERING] = COLOR_BLUE;
- mapped_colors[REDRING] = COLOR_RED;
- mapped_colors[GREENRING] = COLOR_GREEN;
- mapped_colors[YELLOWRING] = COLOR_YELLOW;
- mapped_colors[BLACKRING] = COLOR_BLACK;
-
- dests[BLUERING][0] = -spacing;
- dests[BLUERING][1] = top_y;
- dests[BLUERING][2] = top_z;
-
- dests[BLACKRING][0] = 0.0;
- dests[BLACKRING][1] = top_y;
- dests[BLACKRING][2] = top_z;
-
- dests[REDRING][0] = spacing;
- dests[REDRING][1] = top_y;
- dests[REDRING][2] = top_z;
-
- dests[YELLOWRING][0] = -spacing / 2.0;
- dests[YELLOWRING][1] = bottom_y;
- dests[YELLOWRING][2] = bottom_z;
-
- dests[GREENRING][0] = spacing / 2.0;
- dests[GREENRING][1] = bottom_y;
- dests[GREENRING][2] = bottom_z;
-
- base = 2.0;
- height = 2.0;
- theTorus = glGenLists(1);
- glNewList(theTorus, GL_COMPILE);
- FillTorus(0.1, 8, 1.0, 25);
- glEndList();
-
- x = (float)XSIZE;
- y = (float)YSIZE;
- aspect = x / y;
- glEnable(GL_CULL_FACE);
- glCullFace(GL_BACK);
- glEnable(GL_DEPTH_TEST);
- glClearDepth(1.0);
-
- if (rgb)
- {
- glClearColor(0.5, 0.5, 0.5, 0.0);
- glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
- glLightfv(GL_LIGHT0, GL_SPECULAR, light0_specular);
- glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
- glEnable(GL_LIGHT0);
-
- glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, lmodel_local);
- glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
- glEnable(GL_LIGHTING);
-
- glMaterialfv(GL_FRONT, GL_AMBIENT, bevel_mat_ambient);
- glMaterialfv(GL_FRONT, GL_SHININESS, bevel_mat_shininess);
- glMaterialfv(GL_FRONT, GL_SPECULAR, bevel_mat_specular);
- glMaterialfv(GL_FRONT, GL_DIFFUSE, bevel_mat_diffuse);
-
- glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
- glEnable(GL_COLOR_MATERIAL);
- glShadeModel(GL_SMOOTH);
- }
- else
- {
- glClearIndex(BACKGROUND);
- glShadeModel(GL_FLAT);
- }
-
- glMatrixMode(GL_PROJECTION);
- gluPerspective(45, 1.33, 0.1, 100.0);
- glMatrixMode(GL_MODELVIEW);
- }
-
-UGL_LOCAL void echoUse(void)
- {
- printf("tOlympic keys:\n");
- printf(" SPACE Reinitialize\n");
- printf(" ESC Exit\n");
- }
-
-UGL_LOCAL void readKey (UGL_WCHAR key)
- {
- switch(key)
- {
- case UGL_UNI_SPACE:
- ReInit();
- break;
- case UGL_UNI_ESCAPE:
- stopWex = 1;
- break;
- }
- }
-
-UGL_LOCAL void loopEvent(void)
- {
- UGL_EVENT event;
- UGL_INPUT_EVENT * pInputEvent;
-
- UGL_FOREVER
- {
- if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
- != UGL_STATUS_Q_EMPTY)
- {
- pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
- pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- readKey(pInputEvent->type.keyboard.key);
- }
-
- drawGL();
- if (stopWex)
- break;
- }
- }
-
-void windMLOlympic (UGL_BOOL windMLMode);
-
-void uglolympic (void)
- {
- taskSpawn("tOlympic", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLOlympic,
- 0,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLOlympic(UGL_BOOL windMLMode)
- {
- UGL_INPUT_DEVICE_ID keyboardDevId;
-
- uglInitialize();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
-
- if (uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0,
- (UGL_UINT32 *)&eventServiceId) == UGL_STATUS_OK)
- {
- qId = uglEventQCreate (eventServiceId, 100);
- }
- else
- {
- eventServiceId = UGL_NULL;
- }
-
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
-
- if (umc == NULL)
- {
- uglDeinitialize();
- return;
- }
-
- uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
- UGL_MESA_FULLSCREEN_HEIGHT);
-
- uglMesaGetIntegerv(UGL_MESA_RGB, &rgb);
-
- initGL();
-
- echoUse();
-
- stopWex = 0;
- loopEvent();
-
- if (eventServiceId != UGL_NULL)
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize();
-
- return;
- }
diff --git a/progs/windml/uglpoint.c b/progs/windml/uglpoint.c
deleted file mode 100644
index 49c432c3a41..00000000000
--- a/progs/windml/uglpoint.c
+++ /dev/null
@@ -1,277 +0,0 @@
-
-/* uglpoint.c - WindML/Mesa example program */
-
-/* Copyright (C) 2001 by Wind River Systems, Inc */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * The MIT License
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Authors:
- * Stephane Raimbault <[email protected]>
- */
-
-/*
-DESCRIPTION
-Draw a single point.
-*/
-
-#include <stdio.h>
-#include <math.h>
-
-#include <ugl/ugl.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-
-#include <GL/uglmesa.h>
-
-#define DOUBLE_BUFFER GL_TRUE
-
-enum {
- BLACK = 0,
- RED,
- GREEN,
- BLUE,
- WHITE
-};
-
-UGL_LOCAL GLuint rgb;
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-UGL_LOCAL GLint angleT;
-
-UGL_LOCAL void initGL (void)
- {
- /* By passed in RGB mode */
- uglMesaSetColor(BLACK, 0.0, 0.0, 0.0);
- uglMesaSetColor(RED, 1.0, 0.0, 0.0);
- uglMesaSetColor(GREEN, 0.0, 1.0, 0.0);
- uglMesaSetColor(BLUE, 0.0, 0.0, 1.0);
- uglMesaSetColor(WHITE, 1.0, 1.0, 1.0);
-
- glOrtho(0.0, 1.0, 0.0, 1.0, -20.0, 20.0);
-
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClearIndex(BLACK);
- }
-
-UGL_LOCAL void drawGL (void)
- {
- GLint i;
- GLfloat x, y;
-
- /* Avoid blinking in single buffer */
-
- if (DOUBLE_BUFFER)
- glClear(GL_COLOR_BUFFER_BIT);
-
- /* Random points */
-
- glBegin(GL_POINTS);
- (rgb) ? glColor3f(1.0, 0.0, 0.0): glIndexi(RED);
-
- for (i=0; i<150; i++)
- {
- x = rand() / (RAND_MAX+1.0);
- y = rand() / (RAND_MAX+1.0);
- glVertex2f(x, y);
- }
-
- (rgb) ? glColor3f(0.0, 1.0, 0.0): glIndexi(GREEN);
-
- for (i=0; i<150; i++)
- {
- x = (rand() / (RAND_MAX+1.0));
- y = (rand() / (RAND_MAX+1.0));
- glVertex2f(x, y);
- }
-
- (rgb) ? glColor3f(0.0, 0.0, 1.0): glIndexi(BLUE);
- glVertex2f(0.5,0.5);
-
- for (i=0; i<150; i++)
- {
- x = rand() / (RAND_MAX+1.0);
- y = rand() / (RAND_MAX+1.0);
- glVertex2f(x, y);
- }
-
- glEnd();
-
- /* Smooth triangle */
-
- glPushMatrix();
- glTranslatef(0.5, 0.5, 0);
- glRotatef(angleT, 1.0, -1.0, 0.0);
- angleT = angleT++ % 360;
- glBegin(GL_TRIANGLES);
- (rgb) ? glColor3f(1.0, 0.0, 0.0): glIndexi(RED);
- glVertex2f(0.75, 0.25);
- (rgb) ? glColor3f(0.0, 1.0, 0.0): glIndexi(GREEN);
- glVertex2f(0.75, 0.75);
- (rgb) ? glColor3f(0.0, 0.0, 1.0): glIndexi(BLUE);
- glVertex2f(0.25, 0.75);
- glEnd();
- glPopMatrix();
-
- /* Flush and swap */
-
- glFlush();
-
- uglMesaSwapBuffers();
- }
-
-/************************************************************************
-*
-* getEvent
-*
-* RETURNS: true or false
-*
-* NOMANUAL
-*
-*/
-
-UGL_LOCAL int getEvent(void)
- {
- UGL_EVENT event;
- UGL_STATUS status;
- int retVal = 0;
-
- status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
-
- while (status != UGL_STATUS_Q_EMPTY)
- {
- UGL_INPUT_EVENT * pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- retVal = 1;
-
- status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
- }
-
- return(retVal);
- }
-
-void windMLPoint (UGL_BOOL windMLMode);
-
-void uglpoint (void)
- {
- taskSpawn ("tPoint", 210, VX_FP_TASK, 100000,
- (FUNCPTR)windMLPoint, UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLPoint (UGL_BOOL windMLMode)
- {
- GLubyte pPixels[4];
- GLsizei width, height;
- UGL_INPUT_DEVICE_ID keyboardDevId;
-
- angleT = 0;
-
- uglInitialize();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
-
- if (uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0,
- (UGL_UINT32 *)&eventServiceId) == UGL_STATUS_OK)
- {
- qId = uglEventQCreate (eventServiceId, 100);
- }
- else
- {
- eventServiceId = UGL_NULL;
- }
-
- if (DOUBLE_BUFFER)
- {
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
- }
- else
- {
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_SINGLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_SINGLE, NULL);
- }
-
- if (umc == NULL)
- {
- uglDeinitialize();
- return;
- }
-
- /* Fullscreen */
-
- uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
- UGL_MESA_FULLSCREEN_HEIGHT);
-
- /* RGB or CI ? */
-
- uglMesaGetIntegerv(UGL_MESA_RGB, &rgb);
-
- initGL();
-
- while (!getEvent())
- drawGL();
-
- uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
- uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
-
- printf ("glReadPixel return ");
- if (rgb)
- {
- glReadPixels(width/2, height/2,
- 1, 1, GL_RGB,
- GL_UNSIGNED_BYTE, pPixels);
- glFlush();
- printf ("R:%i G:%i B:%i (RGB)", pPixels[0], pPixels[1], pPixels[2]);
- }
- else
- {
- glReadPixels(width/2, height/2,
- 1, 1, GL_COLOR_INDEX,
- GL_UNSIGNED_BYTE, pPixels);
- glFlush();
- if (pPixels[0] == BLUE)
- printf ("BLUE (CI)");
- else
- printf ("%i (CI))", pPixels[0]);
- }
-
- printf(" for %ix%i\n", width/2, height/2);
-
- if (eventServiceId != UGL_NULL)
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize();
-
- return;
- }
diff --git a/progs/windml/uglstencil.c b/progs/windml/uglstencil.c
deleted file mode 100644
index 07e8fc626f3..00000000000
--- a/progs/windml/uglstencil.c
+++ /dev/null
@@ -1,242 +0,0 @@
-
-/* Copyright (c) Mark J. Kilgard, 1994. */
-
-/*
- * (c) Copyright 1993, Silicon Graphics, Inc.
- * ALL RIGHTS RESERVED
- * Permission to use, copy, modify, and distribute this software for
- * any purpose and without fee is hereby granted, provided that the above
- * copyright notice appear in all copies and that both the copyright notice
- * and this permission notice appear in supporting documentation, and that
- * the name of Silicon Graphics, Inc. not be used in advertising
- * or publicity pertaining to distribution of the software without specific,
- * written prior permission.
- *
- * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
- * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
- * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
- * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
- * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
- * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
- * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
- * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
- * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
- * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * US Government Users Restricted Rights
- * Use, duplication, or disclosure by the Government is subject to
- * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
- * (c)(1)(ii) of the Rights in Technical Data and Computer Software
- * clause at DFARS 252.227-7013 and/or in similar or successor
- * clauses in the FAR or the DOD or NASA FAR Supplement.
- * Unpublished-- rights reserved under the copyright laws of the
- * United States. Contractor/manufacturer is Silicon Graphics,
- * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
- *
- * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
- */
-/* stencil.c
- * This program draws two rotated tori in a window.
- * A diamond in the center of the window masks out part
- * of the scene. Within this mask, a different model
- * (a sphere) is drawn in a different color.
- */
-
-/*
- * Conversion to UGL/Mesa by Stephane Raimbault, 2001
- */
-
-#include <stdio.h>
-#include <math.h>
-
-#include <ugl/ugl.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-
-#include <GL/uglmesa.h>
-#include <GL/glu.h>
-#include <GL/uglglutshapes.h>
-
-#define YELLOWMAT 1
-#define BLUEMAT 2
-
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-
-UGL_LOCAL void initGL (GLsizei w, GLsizei h)
- {
- GLfloat yellow_diffuse[] = { 0.7, 0.7, 0.0, 1.0 };
- GLfloat yellow_specular[] = { 1.0, 1.0, 1.0, 1.0 };
-
- GLfloat blue_diffuse[] = { 0.1, 0.1, 0.7, 1.0 };
- GLfloat blue_specular[] = { 0.1, 1.0, 1.0, 1.0 };
-
- GLfloat position_one[] = { 1.0, 1.0, 1.0, 0.0 };
-
- glNewList(YELLOWMAT, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_DIFFUSE, yellow_diffuse);
- glMaterialfv(GL_FRONT, GL_SPECULAR, yellow_specular);
- glMaterialf(GL_FRONT, GL_SHININESS, 64.0);
- glEndList();
-
- glNewList(BLUEMAT, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_DIFFUSE, blue_diffuse);
- glMaterialfv(GL_FRONT, GL_SPECULAR, blue_specular);
- glMaterialf(GL_FRONT, GL_SHININESS, 45.0);
- glEndList();
-
- glLightfv(GL_LIGHT0, GL_POSITION, position_one);
-
- glEnable(GL_LIGHT0);
- glEnable(GL_LIGHTING);
- glDepthFunc(GL_LESS);
- glEnable(GL_DEPTH_TEST);
-
- glClearStencil(0x0);
- glEnable(GL_STENCIL_TEST);
-
- glClear(GL_STENCIL_BUFFER_BIT);
-
-/* create a diamond shaped stencil area */
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-3.0, 3.0, -3.0, 3.0, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glStencilFunc (GL_ALWAYS, 0x1, 0x1);
- glStencilOp (GL_REPLACE, GL_REPLACE, GL_REPLACE);
- glBegin(GL_QUADS);
- glVertex3f (-1.0, 0.0, 0.0);
- glVertex3f (0.0, 1.0, 0.0);
- glVertex3f (1.0, 0.0, 0.0);
- glVertex3f (0.0, -1.0, 0.0);
- glEnd();
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(45.0, (GLfloat) w/(GLfloat) h, 3.0, 7.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -5.0);
- }
-
-/* Draw a sphere in a diamond-shaped section in the
- * middle of a window with 2 tori.
- */
-UGL_LOCAL void drawGL(void)
- {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
-
-/* draw blue sphere where the stencil is 1 */
- glStencilFunc (GL_EQUAL, 0x1, 0x1);
- glCallList (BLUEMAT);
- glutSolidSphere (0.5, 15, 15);
-
-/* draw the tori where the stencil is not 1 */
- glStencilFunc (GL_NOTEQUAL, 0x1, 0x1);
- glPushMatrix();
- glRotatef (45.0, 0.0, 0.0, 1.0);
- glRotatef (45.0, 0.0, 1.0, 0.0);
- glCallList (YELLOWMAT);
- glutSolidTorus (0.275, 0.85, 15, 15);
- glPushMatrix();
- glRotatef (90.0, 1.0, 0.0, 0.0);
- glutSolidTorus (0.275, 0.85, 15, 15);
- glPopMatrix();
- glPopMatrix();
-
- glFlush();
-
- uglMesaSwapBuffers();
- }
-
-UGL_LOCAL int getEvent(void)
- {
- UGL_EVENT event;
- UGL_STATUS status;
- int retVal = 0;
-
- status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
-
- while (status != UGL_STATUS_Q_EMPTY)
- {
- UGL_INPUT_EVENT * pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- retVal = 1;
-
- status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
- }
-
- return(retVal);
- }
-
-void windMLStencil (UGL_BOOL windMLMode);
-
-void uglstencil (void)
- {
- taskSpawn("tStencil", 210, VX_FP_TASK, 100000,
- (FUNCPTR)windMLStencil,UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLStencil(UGL_BOOL windMLMode)
- {
- UGL_INPUT_DEVICE_ID keyboardDevId;
- GLsizei width, height;
-
- uglInitialize();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
-
- uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
-
- qId = uglEventQCreate (eventServiceId, 100);
-
- if (windMLMode)
- umc = uglMesaCreateNewContextExt(UGL_MESA_SINGLE
- | UGL_MESA_WINDML_EXCLUSIVE,
- 16,
- 8,
- 0,0,0,0,
- NULL);
- else
- umc = uglMesaCreateNewContextExt(UGL_MESA_SINGLE,
- 16,
- 8,
- 0,0,0,0,
- NULL);
-
- if (umc == NULL)
- {
- uglDeinitialize();
- return;
- }
-
- /* Fullscreen */
-
- uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
- UGL_MESA_FULLSCREEN_HEIGHT);
-
- uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
- uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
-
- initGL(width, height);
-
- drawGL();
-
- while (!getEvent());
-
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize();
-
- return;
- }
-
diff --git a/progs/windml/uglteapot.c b/progs/windml/uglteapot.c
deleted file mode 100644
index 651fe0990e1..00000000000
--- a/progs/windml/uglteapot.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * The MIT License
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Linux Magazine July 2001
- * Conversion to UGL/Mesa from GLUT by Stephane Raimbault, 2001
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-
-#include <ugl/ugl.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-#include <ugl/uglucode.h>
-
-#include <GL/uglmesa.h>
-#include <GL/glu.h>
-
-/* Need GLUT_SHAPES */
-
-#include <GL/uglglutshapes.h>
-
-#ifndef PI
-#define PI 3.14159265
-#endif
-
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-UGL_LOCAL volatile UGL_BOOL stopWex;
-
-UGL_LOCAL GLint angle;
-UGL_LOCAL GLfloat Sin[360], Cos[360];
-UGL_LOCAL GLfloat L0pos[]={0.0, 2.0, -1.0};
-UGL_LOCAL GLfloat L0dif[]={0.3, 0.3, 0.8};
-UGL_LOCAL GLfloat L1pos[]={2.0, 2.0, 2.0};
-UGL_LOCAL GLfloat L1dif[]={0.5, 0.5, 0.5};
-UGL_LOCAL GLfloat Mspec[3];
-UGL_LOCAL GLfloat Mshiny;
-UGL_LOCAL GLuint theTeapot;
-
-UGL_LOCAL void calcTableCosSin()
-{
- int i;
- for(i=0;i<360;i++) {
- Cos[i] = cos(((float)i)/180.0*PI);
- Sin[i] = sin(((float)i)/180.0*PI);
- }
-}
-
-UGL_LOCAL void initGL(void)
- {
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glColor3f(1.0, 0.0, 0.0);
- glEnable(GL_DEPTH_TEST);
-
- glShadeModel(GL_SMOOTH);
- glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_LIGHT1);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, L0dif);
- glLightfv(GL_LIGHT0, GL_SPECULAR, L0dif);
- glLightfv(GL_LIGHT1, GL_DIFFUSE, L1dif);
- glLightfv(GL_LIGHT1, GL_SPECULAR, L1dif);
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Mspec);
- glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, Mshiny);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(45.0, 1.0, 0.1, 10.0);
- glMatrixMode(GL_MODELVIEW);
-
- theTeapot = glGenLists(1);
- glNewList(theTeapot, GL_COMPILE);
- glutSolidTeapot(1.0);
- glEndList();
-
- }
-
-UGL_LOCAL void drawGL()
- {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glLoadIdentity();
-
- gluLookAt(4.5*Cos[angle], 2.0,4.5*Sin[angle],0.0,0.0,0.0,0.0,
- 1.0,0.0);
- glLightfv(GL_LIGHT0, GL_POSITION, L0pos);
- glLightfv(GL_LIGHT1, GL_POSITION, L1pos);
-
- glCallList(theTeapot);
-
- glFlush();
-
- uglMesaSwapBuffers();
- }
-
-UGL_LOCAL void echoUse(void)
- {
- printf("tTeapot keys:\n");
- printf(" Left Counter clockwise rotation (y-axis)\n");
- printf(" Right Clockwise rotation (y-axis)\n");
- printf(" j Enable/disable Light0\n");
- printf(" k Enable/disable Light1\n");
- printf(" m Add specular\n");
- printf(" l Remove specular\n");
- printf(" o Add shininess\n");
- printf(" p Remove shininess\n");
- printf(" ESC Exit\n");
- }
-
-
-UGL_LOCAL void readKey (UGL_WCHAR key)
- {
- switch(key)
- {
- case UGL_UNI_RIGHT_ARROW:
- angle +=2;
- if (angle>= 360)
- angle-=360;
- break;
- case UGL_UNI_LEFT_ARROW:
- angle -=2;
- if (angle<0)
- angle+=360;
- break;
- case 'j':
- glIsEnabled(GL_LIGHT0) ?
- glDisable(GL_LIGHT0) : glEnable(GL_LIGHT0);
- break;
- case 'k':
- glIsEnabled(GL_LIGHT1) ?
- glDisable(GL_LIGHT1) : glEnable(GL_LIGHT1);
- break;
- case 'm':
- Mspec[0]+=0.1;
- if(Mspec[0]>1)
- Mspec[0]=1;
- Mspec[1]+=0.1;
- if(Mspec[1]>1)
- Mspec[1]=1;
- Mspec[2]+=0.1;
- if(Mspec[2]>1)
- Mspec[2]=1;
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Mspec);
- break;
- case 'l':
- Mspec[0]-=0.1;
- if(Mspec[0]>1)
- Mspec[0]=1;
- Mspec[1]-=0.1;
- if(Mspec[1]>1)
- Mspec[1]=1;
- Mspec[2]-=0.1;
- if(Mspec[2]>1)
- Mspec[2]=1;
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Mspec);
- break;
- case 'o':
- Mshiny -= 1;
- if (Mshiny<0)
- Mshiny=0;
- glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, Mshiny);
- break;
- case 'p':
- Mshiny += 1;
- if (Mshiny>128)
- Mshiny=128;
- glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, Mshiny);
- break;
- case UGL_UNI_ESCAPE:
- stopWex = UGL_TRUE;
- break;
- }
- }
-
-UGL_LOCAL void loopEvent(void)
- {
- UGL_EVENT event;
- UGL_INPUT_EVENT * pInputEvent;
-
- UGL_FOREVER
- {
- if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
- != UGL_STATUS_Q_EMPTY)
- {
- pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
- pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- readKey(pInputEvent->type.keyboard.key);
- }
-
- drawGL();
- if (stopWex)
- break;
- }
- }
-
-void windMLTeapot (UGL_BOOL windMLMode);
-
-void uglteapot (void)
- {
- taskSpawn ("tTeapot", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTeapot,
- UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLTeapot (UGL_BOOL windMLMode)
- {
- UGL_INPUT_DEVICE_ID keyboardDevId;
- GLsizei displayWidth, displayHeight;
- GLsizei x, y, w, h;
-
- angle = 45;
- Mspec[0] = 0.5;
- Mspec[1] = 0.5;
- Mspec[2] = 0.5;
- Mshiny = 50;
-
- uglInitialize ();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0,
- (UGL_UINT32 *)&keyboardDevId);
-
- uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
-
- qId = uglEventQCreate (eventServiceId, 100);
-
- /* Double buffering */
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
-
- if (umc == NULL)
- {
- uglDeinitialize ();
- return;
- }
-
- uglMesaMakeCurrentContext (umc, 0, 0, 1, 1);
-
- uglMesaGetIntegerv(UGL_MESA_DISPLAY_WIDTH, &displayWidth);
- uglMesaGetIntegerv(UGL_MESA_DISPLAY_HEIGHT, &displayHeight);
-
- h = (displayHeight*2)/3;
- w = h;
- x = (displayWidth-w)/2;
- y = (displayHeight-h)/2;
-
- uglMesaMoveToWindow(x, y);
- uglMesaResizeToWindow(w, h);
-
- calcTableCosSin();
-
- initGL ();
-
- echoUse();
-
- stopWex = UGL_FALSE;
- loopEvent();
-
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize ();
-
- return;
- }
diff --git a/progs/windml/ugltexcube.c b/progs/windml/ugltexcube.c
deleted file mode 100644
index 62b0306e647..00000000000
--- a/progs/windml/ugltexcube.c
+++ /dev/null
@@ -1,379 +0,0 @@
-
-/* ugltexcube.c - WindML/Mesa example program */
-
-/* Copyright (C) 2001 by Wind River Systems, Inc */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * The MIT License
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Authors:
- * Stephane Raimbault <[email protected]>
- */
-
-/*
-DESCRIPTION
-Draw a textured cube
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include <ugl/ugl.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-#include <GL/uglmesa.h>
-#include <GL/glu.h>
-
-#include "../util/readtex.h"
-
-#define IMAGE_FILE "Mesa/images/wrs_logo.rgb"
-
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-
-UGL_LOCAL GLfloat xrot, yrot, zrot;
-UGL_LOCAL GLuint texture[1];
-UGL_LOCAL GLuint theTexCube;
-
-typedef struct {
- GLubyte *data;
- int width, height;
- GLenum format;
- } TEX_IMAGE;
-
-UGL_LOCAL void cleanUp (void);
-
-UGL_LOCAL void loadGLTexture()
- {
- TEX_IMAGE * texImage=NULL;
-
- texImage = (TEX_IMAGE *) malloc(sizeof(TEX_IMAGE));
-
- if (texImage == NULL)
- {
- printf("Error allocating space for image");
- cleanUp();
- exit(1);
- }
-
- texImage->data = LoadRGBImage(IMAGE_FILE, &texImage->width,
- &texImage->height, &texImage->format);
- if (!texImage->data)
- {
- printf("Couldn't read %s\n", IMAGE_FILE);
- free(texImage);
- cleanUp();
- exit(1);
- }
-
- /* Create Texture */
- glGenTextures(1, &texture[0]);
- glBindTexture(GL_TEXTURE_2D, texture[0]);
- glTexImage2D(GL_TEXTURE_2D, 0, 3,
- texImage->width, texImage->height,
- 0, GL_RGB, GL_UNSIGNED_BYTE, texImage->data);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-
- free(texImage->data);
- free(texImage);
- }
-
-UGL_LOCAL void initGL(int width, int height)
- {
-
- /* Load the texture(s) */
- loadGLTexture();
-
- /* Enable texture mapping */
- glEnable(GL_TEXTURE_2D);
-
- /* Clear the background color to black */
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-
- glEnable(GL_CULL_FACE);
-
- /* Enables smooth color shading */
- glShadeModel(GL_SMOOTH);
-
-/* glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); */
-/* glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); */
-
- theTexCube = glGenLists(1);
- glNewList(theTexCube, GL_COMPILE);
-
- /* Choose the texture to use */
- glBindTexture(GL_TEXTURE_2D, texture[0]);
-
- /* Begin drawing a cube */
- glBegin(GL_QUADS);
-
- /* Front face (note that the texture's corners have to match the
- quad's corners) */
-
- /* Bottom left of the texture and quad */
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f(-1.0f, -1.0f, 1.0f);
-
- /* Bottom Right Of The Texture and Quad */
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f(1.0f, -1.0f, 1.0f);
-
- /* Top Right Of The Texture and Quad */
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f(1.0f, 1.0f, 1.0f);
- /* Top Left Of The Texture and Quad */
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f(-1.0f, 1.0f, 1.0f);
-
- /* Back Face */
-
- /* Bottom Right Of The Texture and Quad */
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f(-1.0f, -1.0f, -1.0f);
-
- /* Top Right Of The Texture and Quad */
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f(-1.0f, 1.0f, -1.0f);
-
- /* Top Left Of The Texture and Quad */
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f(1.0f, 1.0f, -1.0f);
-
- /* Bottom Left Of The Texture and Quad */
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f(1.0f, -1.0f, -1.0f);
-
-
- /* Top Face */
-
- /* Top Left Of The Texture and Quad */
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f(-1.0f, 1.0f, -1.0f);
-
- /* Bottom Left Of The Texture and Quad */
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f(-1.0f, 1.0f, 1.0f);
-
- /* Bottom Right Of The Texture and Quad */
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f(1.0f, 1.0f, 1.0f);
-
- /* Top Right Of The Texture and Quad */
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f(1.0f, 1.0f, -1.0f);
-
- /* Bottom Face */
-
- /* Top Right Of The Texture and Quad */
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f(-1.0f, -1.0f, -1.0f);
-
- /* Top Left Of The Texture and Quad */
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f(1.0f, -1.0f, -1.0f);
-
- /* Bottom Left Of The Texture and Quad */
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f(1.0f, -1.0f, 1.0f);
-
- /* Bottom Right Of The Texture and Quad */
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f(-1.0f, -1.0f, 1.0f);
-
-
- /* Right face */
- /* Bottom Right Of The Texture and Quad */
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f(1.0f, -1.0f, -1.0f);
-
- /* Top Right Of The Texture and Quad */
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f(1.0f, 1.0f, -1.0f);
-
- /* Top Left Of The Texture and Quad */
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f(1.0f, 1.0f, 1.0f);
-
- /* Bottom Left Of The Texture and Quad */
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f(1.0f, -1.0f, 1.0f);
-
-
- /* Left Face */
- /* Bottom Left Of The Texture and Quad */
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f(-1.0f, -1.0f, -1.0f);
-
- /* Bottom Right Of The Texture and Quad */
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f(-1.0f, -1.0f, 1.0f);
-
- /* Top Right Of The Texture and Quad */
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f(-1.0f, 1.0f, 1.0f);
-
- /* Top Left Of The Texture and Quad */
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f(-1.0f, 1.0f, -1.0f);
-
- glEnd(); /* done with the polygon */
- glEndList();
-
- glDisable(GL_DITHER);
- glMatrixMode(GL_PROJECTION);
- /* Reset the projection matrix */
- glLoadIdentity();
- /* Calculate the aspect ratio of the window */
- gluPerspective(45.0f, (GLfloat) width / (GLfloat) height, 0.1f, 100.0f);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- }
-
-UGL_LOCAL void drawGL()
- {
- glClear(GL_COLOR_BUFFER_BIT);
-
- /* Reset The View */
- glPushMatrix();
-
- /* Move 8 units into the screen */
- glTranslatef(0.0f, 0.0f, -8.0f);
-
- /* Rotate on the X axis */
- glRotatef(xrot, 1.0f, 0.0f, 0.0f);
-
- /* Rotate on the Y axis */
- glRotatef(yrot, 0.0f, 1.0f, 0.0f);
-
- /* Rotate On The Z Axis */
- glRotatef(zrot, 0.0f, 0.0f, 1.0f);
-
- glCallList(theTexCube);
-
- glFlush();
-
- uglMesaSwapBuffers();
-
- glPopMatrix();
-
- xrot += 1.6f;
- yrot += 1.6f;
- zrot += 1.6f;
-}
-
-UGL_LOCAL int getEvent(void)
- {
- UGL_EVENT event;
- UGL_STATUS status;
- int retVal = 0;
-
- status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
-
- while (status != UGL_STATUS_Q_EMPTY)
- {
- UGL_INPUT_EVENT * pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- retVal = 1;
-
- status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
- }
-
- return(retVal);
- }
-
-UGL_LOCAL void cleanUp (void)
- {
- if (eventServiceId != UGL_NULL)
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize();
- }
-
-void windMLTexCube (UGL_BOOL windMLMode);
-
-void ugltexcube (void)
- {
- taskSpawn("tTexCube", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTexCube,
- UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-
-void windMLTexCube(UGL_BOOL windMLMode)
- {
- GLuint width, height;
- UGL_INPUT_DEVICE_ID keyboardDevId;
-
- uglInitialize();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
-
- if (uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0,
- (UGL_UINT32 *)&eventServiceId) == UGL_STATUS_OK)
- {
- qId = uglEventQCreate (eventServiceId, 100);
- }
- else
- {
- eventServiceId = UGL_NULL;
- }
-
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
-
- if (umc == NULL)
- {
- uglDeinitialize();
- return;
- }
-
- uglMesaMakeCurrentContext(umc, 0, 0,
- UGL_MESA_FULLSCREEN_WIDTH,
- UGL_MESA_FULLSCREEN_HEIGHT);
-
-
- uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
- uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
-
- initGL(width, height);
-
- while(!getEvent())
- drawGL();
-
- cleanUp();
-
- return;
- }
-
-
diff --git a/progs/windml/ugltexcyl.c b/progs/windml/ugltexcyl.c
deleted file mode 100644
index db66d1ff67b..00000000000
--- a/progs/windml/ugltexcyl.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * Textured cylinder demo: lighting, texturing, reflection mapping.
- *
- * Brian Paul May 1997 This program is in the public domain.
- *
- * Conversion to UGL/Mesa by Stephane Raimbault
- */
-
-/*
- * Revision 1.2 2001/09/10 19:21:13 brianp
- * WindML updates (Stephane Raimbault)
- *
- * Revision 1.1 2001/08/20 16:07:11 brianp
- * WindML driver (Stephane Raimbault)
- *
- * Revision 1.5 2001/03/27 17:35:26 brianp
- * set initial window pos
- *
- * Revision 1.4 2000/12/24 22:53:54 pesco
- * * demos/Makefile.am (INCLUDES): Added -I$(top_srcdir)/util.
- * * demos/Makefile.X11, demos/Makefile.BeOS-R4, demos/Makefile.cygnus:
- * Essentially the same.
- * Program files updated to include "readtex.c", not "../util/readtex.c".
- * * demos/reflect.c: Likewise for "showbuffer.c".
- *
- *
- * * Makefile.am (EXTRA_DIST): Added top-level regular files.
- *
- * * include/GL/Makefile.am (INC_X11): Added glxext.h.
- *
- *
- * * src/GGI/include/ggi/mesa/Makefile.am (EXTRA_HEADERS): Include
- * Mesa GGI headers in dist even if HAVE_GGI is not given.
- *
- * * configure.in: Look for GLUT and demo source dirs in $srcdir.
- *
- * * src/swrast/Makefile.am (libMesaSwrast_la_SOURCES): Set to *.[ch].
- * More source list updates in various Makefile.am's.
- *
- * * Makefile.am (dist-hook): Remove CVS directory from distribution.
- * (DIST_SUBDIRS): List all possible subdirs here.
- * (SUBDIRS): Only list subdirs selected for build again.
- * The above two applied to all subdir Makefile.am's also.
- *
- * Revision 1.3 2000/09/29 23:09:39 brianp
- * added fps output
- *
- * Revision 1.2 1999/10/21 16:39:06 brianp
- * added -info command line option
- *
- * Revision 1.1.1.1 1999/08/19 00:55:40 jtg
- * Imported sources
- *
- * Revision 3.3 1999/03/28 18:24:37 brianp
- * minor clean-up
- *
- * Revision 3.2 1998/11/05 04:34:04 brianp
- * moved image files to ../images/ directory
- *
- * Revision 3.1 1998/06/23 03:16:51 brianp
- * added Point/Linear sampling menu items
- *
- * Revision 3.0 1998/02/14 18:42:29 brianp
- * initial rev
- *
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <tickLib.h>
-
-#include <ugl/ugl.h>
-#include <ugl/uglucode.h>
-#include <ugl/uglevent.h>
-#include <ugl/uglinput.h>
-
-#include <GL/uglmesa.h>
-#include <GL/glu.h>
-
-#include "../util/readtex.h"
-
-#define TEXTURE_FILE "Mesa/images/reflect.rgb"
-
-#define LIT 1
-#define TEXTURED 2
-#define REFLECT 3
-#define ANIMATE 10
-#define POINT_FILTER 20
-#define LINEAR_FILTER 21
-#define QUIT 100
-#define COUNT_FRAMES
-
-UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
-UGL_LOCAL UGL_EVENT_Q_ID qId;
-UGL_LOCAL volatile UGL_BOOL stopWex;
-UGL_LOCAL UGL_MESA_CONTEXT umc;
-
-UGL_LOCAL GLuint CylinderObj;
-UGL_LOCAL GLboolean Animate;
-UGL_LOCAL GLboolean linearFilter;
-
-UGL_LOCAL GLfloat Xrot, Yrot, Zrot;
-UGL_LOCAL GLfloat DXrot, DYrot;
-
-UGL_LOCAL GLuint limit;
-UGL_LOCAL GLuint count;
-UGL_LOCAL GLuint tickStart, tickStop, tickBySec;
-
-UGL_LOCAL void cleanUp (void);
-
-UGL_LOCAL void drawGL(void)
- {
-#ifdef COUNT_FRAMES
- int time;
-#endif
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- glScalef(5.0, 5.0, 5.0);
- glCallList(CylinderObj);
-
- glPopMatrix();
-
- uglMesaSwapBuffers();
-
- if (Animate)
- {
- Xrot += DXrot;
- Yrot += DYrot;
- }
-
-#ifdef COUNT_FRAMES
- if (count > limit)
- {
- tickStop = tickGet ();
- time = (tickStop-tickStart)/tickBySec;
- printf (" %i fps\n", count/time);
- tickStart = tickStop;
- count = 0;
- }
- else
- count++;
-#endif
-
- }
-
-UGL_LOCAL void echoUse(void)
- {
- printf("Keys:\n");
- printf(" Up/Down Rotate on Y\n");
- printf(" Left/Right Rotate on X\n");
- printf(" a Toggle animation\n");
- printf(" f Toggle point/linear filtered\n");
- printf(" l Lit\n");
- printf(" t Textured\n");
- printf(" r Reflect\n");
- printf(" ESC Exit\n");
- }
-
-UGL_LOCAL void readKey(UGL_WCHAR key)
- {
- float step = 3.0;
- switch (key)
- {
- case 'a':
- Animate = !Animate;
- break;
- case 'f':
- if(linearFilter)
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
- GL_NEAREST);
- }
- else
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
- GL_LINEAR);
- }
- linearFilter = !linearFilter;
- break;
- case 'l':
- glEnable(GL_LIGHTING);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_TEXTURE_GEN_S);
- glDisable(GL_TEXTURE_GEN_T);
- break;
- case 't':
- glDisable(GL_LIGHTING);
- glEnable(GL_TEXTURE_2D);
- glDisable(GL_TEXTURE_GEN_S);
- glDisable(GL_TEXTURE_GEN_T);
- break;
- case 'r':
- glDisable(GL_LIGHTING);
- glEnable(GL_TEXTURE_2D);
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
- break;
- case UGL_UNI_UP_ARROW:
- Xrot += step;
- break;
- case UGL_UNI_DOWN_ARROW:
- Xrot -= step;
- break;
- case UGL_UNI_LEFT_ARROW:
- Yrot += step;
- break;
- case UGL_UNI_RIGHT_ARROW:
- Yrot -= step;
- break;
- case UGL_UNI_ESCAPE:
- stopWex = UGL_TRUE;
- break;
- }
- }
-
-UGL_LOCAL void loopEvent(void)
- {
- UGL_EVENT event;
- UGL_INPUT_EVENT * pInputEvent;
-
- UGL_FOREVER
- {
- if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
- != UGL_STATUS_Q_EMPTY)
- {
- pInputEvent = (UGL_INPUT_EVENT *)&event;
-
- if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
- pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
- readKey(pInputEvent->type.keyboard.key);
- }
-
- drawGL();
- if (stopWex)
- break;
- }
- }
-
-UGL_LOCAL void initGL(void)
- {
- GLUquadricObj *q = gluNewQuadric();
- CylinderObj = glGenLists(1);
- glNewList(CylinderObj, GL_COMPILE);
-
- glTranslatef(0.0, 0.0, -1.0);
-
- /* cylinder */
- gluQuadricNormals(q, GL_SMOOTH);
- gluQuadricTexture(q, GL_TRUE);
- gluCylinder(q, 0.6, 0.6, 2.0, 24, 1);
-
- /* end cap */
- glTranslatef(0.0, 0.0, 2.0);
- gluDisk(q, 0.0, 0.6, 24, 1);
-
- /* other end cap */
- glTranslatef(0.0, 0.0, -2.0);
- gluQuadricOrientation(q, GLU_INSIDE);
- gluDisk(q, 0.0, 0.6, 24, 1);
-
- glEndList();
- gluDeleteQuadric(q);
-
- /* lighting */
- glEnable(GL_LIGHTING);
- {
- GLfloat gray[4] = {0.2, 0.2, 0.2, 1.0};
- GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
- GLfloat teal[4] = { 0.0, 1.0, 0.8, 1.0 };
- glMaterialfv(GL_FRONT, GL_DIFFUSE, teal);
- glLightfv(GL_LIGHT0, GL_AMBIENT, gray);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, white);
- glEnable(GL_LIGHT0);
- }
-
- /* fitering = nearest, initially */
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
- glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
-
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
-
- if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB))
- {
- printf("Error: couldn't load texture image\n");
- cleanUp();
- exit(1);
- }
-
- glEnable(GL_CULL_FACE); /* don't need Z testing for convex objects */
-
- glEnable(GL_LIGHTING);
-
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -70.0 );
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
-
-#ifdef COUNT_FRAMES
- tickStart = tickGet ();
- tickBySec = sysClkRateGet ();
-#endif
-
- }
-
-UGL_LOCAL void cleanUp (void)
- {
- uglEventQDestroy (eventServiceId, qId);
-
- uglMesaDestroyContext();
- uglDeinitialize ();
- }
-
-void windMLTexCyl (UGL_BOOL windMLMode);
-
-void ugltexcyl (void)
- {
- taskSpawn ("tTexCyl", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTexCyl,
- UGL_FALSE,1,2,3,4,5,6,7,8,9);
- }
-
-void windMLTexCyl (UGL_BOOL windMLMode)
- {
- UGL_INPUT_DEVICE_ID keyboardDevId;
- GLsizei displayWidth, displayHeight;
- GLsizei x, y, w, h;
-
- CylinderObj = 0;
- Animate = GL_TRUE;
- linearFilter = GL_FALSE;
- Xrot = 0.0;
- Yrot = 0.0;
- Zrot = 0.0;
- DXrot = 1.0;
- DYrot = 2.5;
- limit = 100;
- count = 1;
-
- uglInitialize ();
-
- uglDriverFind (UGL_KEYBOARD_TYPE, 0,
- (UGL_UINT32 *)&keyboardDevId);
-
- uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
-
- qId = uglEventQCreate (eventServiceId, 100);
-
- /* Double buffering */
- if (windMLMode)
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
- | UGL_MESA_WINDML_EXCLUSIVE, NULL);
- else
- umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
-
- if (umc == NULL)
- {
- uglDeinitialize ();
- return;
- }
-
- uglMesaMakeCurrentContext (umc, 0, 0, 1, 1);
-
- uglMesaGetIntegerv(UGL_MESA_DISPLAY_WIDTH, &displayWidth);
- uglMesaGetIntegerv(UGL_MESA_DISPLAY_HEIGHT, &displayHeight);
-
- h = (displayHeight*3)/4;
- w = h;
- x = (displayWidth-w)/2;
- y = (displayHeight-h)/2;
-
- uglMesaMoveToWindow(x, y);
- uglMesaResizeToWindow(w, h);
-
- initGL ();
-
- echoUse();
-
- stopWex = UGL_FALSE;
- loopEvent();
-
- cleanUp();
-
- return;
- }
-
diff --git a/progs/windml/wrs_logo.bmp b/progs/windml/wrs_logo.bmp
deleted file mode 100644
index 9a9f04255be..00000000000
--- a/progs/windml/wrs_logo.bmp
+++ /dev/null
Binary files differ
diff --git a/progs/xdemos/.gitignore b/progs/xdemos/.gitignore
index 5ae0f5a0627..a65b890d3dc 100644
--- a/progs/xdemos/.gitignore
+++ b/progs/xdemos/.gitignore
@@ -27,3 +27,4 @@ xfont
xrotfontdemo
yuvrect_client
msctest
+omlsync
diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile
index f866a328656..9cf984b59e5 100644
--- a/progs/xdemos/Makefile
+++ b/progs/xdemos/Makefile
@@ -32,6 +32,7 @@ PROGS = \
msctest \
multictx \
offset \
+ omlsync \
overlay \
pbinfo \
pbdemo \
diff --git a/progs/xdemos/glsync.c b/progs/xdemos/glsync.c
index c00ba9e4687..3751373e23b 100644
--- a/progs/xdemos/glsync.c
+++ b/progs/xdemos/glsync.c
@@ -63,10 +63,9 @@ void (*swap_interval)();
static int GLXExtensionSupported(Display *dpy, const char *extension)
{
- const char *extensionsString, *client_extensions, *pos;
+ const char *extensionsString, *pos;
extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
- client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
pos = strstr(extensionsString, extension);
@@ -74,12 +73,6 @@ static int GLXExtensionSupported(Display *dpy, const char *extension)
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
- pos = strstr(client_extensions, extension);
-
- if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
- (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
- return 1;
-
return 0;
}
@@ -235,7 +228,7 @@ int main(int argc, char *argv[])
XMapWindow(disp, winGL);
ret = glXMakeCurrent(disp, winGL, context);
- if (ret) {
+ if (!ret) {
fprintf(stderr, "failed to make context current: %d\n", ret);
}
diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c
index d8710882102..332f5c2f463 100644
--- a/progs/xdemos/glxinfo.c
+++ b/progs/xdemos/glxinfo.c
@@ -171,7 +171,7 @@ print_program_limits(GLenum target)
GLenum token;
const char *name;
};
- static const struct token_name limits[] = {
+ static const struct token_name common_limits[] = {
{ GL_MAX_PROGRAM_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_INSTRUCTIONS_ARB" },
{ GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB" },
{ GL_MAX_PROGRAM_TEMPORARIES_ARB, "GL_MAX_PROGRAM_TEMPORARIES_ARB" },
@@ -184,6 +184,9 @@ print_program_limits(GLenum target)
{ GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB, "GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB" },
{ GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, "GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB" },
{ GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, "GL_MAX_PROGRAM_ENV_PARAMETERS_ARB" },
+ { (GLenum) 0, NULL }
+ };
+ static const struct token_name fragment_limits[] = {
{ GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB" },
{ GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB" },
{ GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB, "GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB" },
@@ -192,8 +195,10 @@ print_program_limits(GLenum target)
{ GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB, "GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB" },
{ (GLenum) 0, NULL }
};
+
PFNGLGETPROGRAMIVARBPROC GetProgramivARB_func = (PFNGLGETPROGRAMIVARBPROC)
glXGetProcAddressARB((GLubyte *) "glGetProgramivARB");
+
GLint max[1];
int i;
@@ -207,10 +212,18 @@ print_program_limits(GLenum target)
return; /* something's wrong */
}
- for (i = 0; limits[i].token; i++) {
- GetProgramivARB_func(target, limits[i].token, max);
+ for (i = 0; common_limits[i].token; i++) {
+ GetProgramivARB_func(target, common_limits[i].token, max);
if (glGetError() == GL_NO_ERROR) {
- printf(" %s = %d\n", limits[i].name, max[0]);
+ printf(" %s = %d\n", common_limits[i].name, max[0]);
+ }
+ }
+ if (target == GL_FRAGMENT_PROGRAM_ARB) {
+ for (i = 0; fragment_limits[i].token; i++) {
+ GetProgramivARB_func(target, fragment_limits[i].token, max);
+ if (glGetError() == GL_NO_ERROR) {
+ printf(" %s = %d\n", fragment_limits[i].name, max[0]);
+ }
}
}
#endif /* GL_ARB_vertex_program / GL_ARB_fragment_program */
@@ -1100,7 +1113,7 @@ usage(void)
printf("\t-display <dname>: Print GLX visuals on specified server.\n");
printf("\t-h: This information.\n");
printf("\t-i: Force an indirect rendering context.\n");
- printf("\t-b: Find the 'best' visual and print it's number.\n");
+ printf("\t-b: Find the 'best' visual and print its number.\n");
printf("\t-l: Print interesting OpenGL limits.\n");
}
diff --git a/progs/xdemos/msctest.c b/progs/xdemos/msctest.c
index 001ecf04d6c..11b04344426 100644
--- a/progs/xdemos/msctest.c
+++ b/progs/xdemos/msctest.c
@@ -45,10 +45,9 @@ void (*wait_sync)(Display *dpy, Window winGL, int64_t target_msc, int64_t diviso
static int GLXExtensionSupported(Display *dpy, const char *extension)
{
- const char *extensionsString, *client_extensions, *pos;
+ const char *extensionsString, *pos;
extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
- client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
pos = strstr(extensionsString, extension);
@@ -56,12 +55,6 @@ static int GLXExtensionSupported(Display *dpy, const char *extension)
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
- pos = strstr(client_extensions, extension);
-
- if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
- (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
- return 1;
-
return 0;
}
@@ -167,8 +160,8 @@ int main(int argc, char *argv[])
glXMakeCurrent(disp, winGL, context);
- get_sync_values = glXGetProcAddress((unsigned char *)"glXGetSyncValuesOML");
- wait_sync = glXGetProcAddress((unsigned char *)"glXWaitForMscOML");
+ get_sync_values = (void *)glXGetProcAddress((unsigned char *)"glXGetSyncValuesOML");
+ wait_sync = (void *)glXGetProcAddress((unsigned char *)"glXWaitForMscOML");
if (!get_sync_values || !wait_sync) {
fprintf(stderr, "failed to get sync values function\n");
diff --git a/progs/xdemos/omlsync.c b/progs/xdemos/omlsync.c
new file mode 100644
index 00000000000..061d6c68613
--- /dev/null
+++ b/progs/xdemos/omlsync.c
@@ -0,0 +1,267 @@
+/*
+ * Copyright © 2007-2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Jesse Barnes <[email protected]>
+ *
+ */
+
+/** @file omlsync.c
+ * The program is simple: it paints a window alternating colors (red &
+ * white) either as fast as possible or synchronized to vblank events
+ *
+ * If run normally, the program should display a window that exhibits
+ * significant tearing between red and white colors (e.g. you might get
+ * a "waterfall" effect of red and white horizontal bars).
+ *
+ * If run with the '-s b' option, the program should synchronize the
+ * window color changes with the vertical blank period, resulting in a
+ * window that looks orangish with a high frequency flicker (which may
+ * be invisible). If the window is moved to another screen, this
+ * property should be preserved. If the window spans two screens, it
+ * shouldn't tear on whichever screen most of the window is on; the
+ * portion on the other screen may show some tearing (like the
+ * waterfall effect above).
+ *
+ * Other options include '-w <width>' and '-h <height>' to set the
+ * window size.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include <GL/glx.h>
+#include <GL/glxext.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+Bool (*glXGetSyncValuesOML)(Display *dpy, GLXDrawable drawable,
+ int64_t *ust, int64_t *msc, int64_t *sbc);
+Bool (*glXGetMscRateOML)(Display *dpy, GLXDrawable drawable, int32_t *numerator,
+ int32_t *denominator);
+int64_t (*glXSwapBuffersMscOML)(Display *dpy, GLXDrawable drawable,
+ int64_t target_msc, int64_t divisor,
+ int64_t remainder);
+Bool (*glXWaitForMscOML)(Display *dpy, GLXDrawable drawable, int64_t target_msc,
+ int64_t divisor, int64_t remainder, int64_t *ust,
+ int64_t *msc, int64_t *sbc);
+Bool (*glXWaitForSbcOML)(Display *dpy, GLXDrawable drawable, int64_t target_sbc,
+ int64_t *ust, int64_t *msc, int64_t *sbc);
+int (*glXSwapInterval)(int interval);
+
+static int GLXExtensionSupported(Display *dpy, const char *extension)
+{
+ const char *extensionsString, *pos;
+
+ extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
+
+ pos = strstr(extensionsString, extension);
+
+ if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
+ (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
+ return 1;
+
+ return 0;
+}
+
+extern char *optarg;
+extern int optind, opterr, optopt;
+static char optstr[] = "w:h:vd:r:n:i:";
+
+static void usage(char *name)
+{
+ printf("usage: %s [-w <width>] [-h <height>] ...\n", name);
+ printf("\t-d<divisor> - divisor for OML swap\n");
+ printf("\t-r<remainder> - remainder for OML swap\n");
+ printf("\t-n<interval> - wait interval for OML WaitMSC\n");
+ printf("\t-i<swap interval> - swap at most once every n frames\n");
+ printf("\t-v: verbose (print count)\n");
+ exit(-1);
+}
+
+int main(int argc, char *argv[])
+{
+ Display *disp;
+ XVisualInfo *pvi;
+ XSetWindowAttributes swa;
+ Window winGL;
+ GLXContext context;
+ int dummy;
+ Atom wmDelete;
+ int64_t ust, msc, sbc;
+ int width = 500, height = 500, verbose = 0, divisor = 0, remainder = 0,
+ wait_interval = 0, swap_interval = 1;
+ int c, i = 1;
+ int ret;
+ int db_attribs[] = { GLX_RGBA,
+ GLX_RED_SIZE, 1,
+ GLX_GREEN_SIZE, 1,
+ GLX_BLUE_SIZE, 1,
+ GLX_DOUBLEBUFFER,
+ GLX_DEPTH_SIZE, 1,
+ None };
+ XSizeHints sizehints;
+
+ opterr = 0;
+ while ((c = getopt(argc, argv, optstr)) != -1) {
+ switch (c) {
+ case 'w':
+ width = atoi(optarg);
+ break;
+ case 'h':
+ height = atoi(optarg);
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case 'd':
+ divisor = atoi(optarg);
+ break;
+ case 'r':
+ remainder = atoi(optarg);
+ break;
+ case 'n':
+ wait_interval = atoi(optarg);
+ break;
+ case 'i':
+ swap_interval = atoi(optarg);
+ break;
+ default:
+ usage(argv[0]);
+ break;
+ }
+ }
+
+ disp = XOpenDisplay(NULL);
+ if (!disp) {
+ fprintf(stderr, "failed to open display\n");
+ return -1;
+ }
+
+ if (!glXQueryExtension(disp, &dummy, &dummy)) {
+ fprintf(stderr, "glXQueryExtension failed\n");
+ return -1;
+ }
+
+ if (!GLXExtensionSupported(disp, "GLX_OML_sync_control")) {
+ fprintf(stderr, "GLX_OML_sync_control not supported\n");
+ return -1;
+ }
+
+ if (!GLXExtensionSupported(disp, "GLX_MESA_swap_control")) {
+ fprintf(stderr, "GLX_MESA_swap_control not supported\n");
+ return -1;
+ }
+
+ pvi = glXChooseVisual(disp, DefaultScreen(disp), db_attribs);
+
+ if (!pvi) {
+ fprintf(stderr, "failed to choose visual, exiting\n");
+ return -1;
+ }
+
+ pvi->screen = DefaultScreen(disp);
+
+ swa.colormap = XCreateColormap(disp, RootWindow(disp, pvi->screen),
+ pvi->visual, AllocNone);
+ swa.border_pixel = 0;
+ swa.event_mask = ExposureMask | KeyPressMask | ButtonPressMask |
+ StructureNotifyMask;
+ winGL = XCreateWindow(disp, RootWindow(disp, pvi->screen),
+ 0, 0,
+ width, height,
+ 0, pvi->depth, InputOutput, pvi->visual,
+ CWBorderPixel | CWColormap | CWEventMask, &swa);
+ if (!winGL) {
+ fprintf(stderr, "window creation failed\n");
+ return -1;
+ }
+ wmDelete = XInternAtom(disp, "WM_DELETE_WINDOW", True);
+ XSetWMProtocols(disp, winGL, &wmDelete, 1);
+
+ sizehints.x = 0;
+ sizehints.y = 0;
+ sizehints.width = width;
+ sizehints.height = height;
+ sizehints.flags = USSize | USPosition;
+
+ XSetNormalHints(disp, winGL, &sizehints);
+ XSetStandardProperties(disp, winGL, "glsync test", "glsync text",
+ None, NULL, 0, &sizehints);
+
+ context = glXCreateContext(disp, pvi, NULL, GL_TRUE);
+ if (!context) {
+ fprintf(stderr, "failed to create glx context\n");
+ return -1;
+ }
+
+ XMapWindow(disp, winGL);
+ ret = glXMakeCurrent(disp, winGL, context);
+ if (!ret) {
+ fprintf(stderr, "failed to make context current: %d\n", ret);
+ }
+
+ glXGetSyncValuesOML = (void *)glXGetProcAddress((unsigned char *)"glXGetSyncValuesOML");
+ glXGetMscRateOML = (void *)glXGetProcAddress((unsigned char *)"glXGetMscRateOML");
+ glXSwapBuffersMscOML = (void *)glXGetProcAddress((unsigned char *)"glXSwapBuffersMscOML");
+ glXWaitForMscOML = (void *)glXGetProcAddress((unsigned char *)"glXWaitForMscOML");
+ glXWaitForSbcOML = (void *)glXGetProcAddress((unsigned char *)"glXWaitForSbcOML");
+ glXSwapInterval = (void *)glXGetProcAddress((unsigned char *)"glXSwapIntervalMESA");
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glXSwapInterval(swap_interval);
+ fprintf(stderr, "set swap interval to %d\n", swap_interval);
+
+ glXGetSyncValuesOML(disp, winGL, &ust, &msc, &sbc);
+ while (i++) {
+ /* Alternate colors to make tearing obvious */
+ if (i & 1) {
+ glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+ glColor3f(1.0f, 1.0f, 1.0f);
+ } else {
+ glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
+ glColor3f(1.0f, 0.0f, 0.0f);
+ }
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glRectf(0, 0, width, height);
+
+ if (!wait_interval)
+ glXSwapBuffersMscOML(disp, winGL, 0, divisor,
+ remainder);
+ else {
+ glXWaitForMscOML(disp, winGL, msc + wait_interval,
+ divisor, remainder, &ust, &msc, &sbc);
+ glXSwapBuffersMscOML(disp, winGL, 0, 0, 0);
+ }
+ }
+
+ XDestroyWindow(disp, winGL);
+ glXDestroyContext(disp, context);
+ XCloseDisplay(disp);
+
+ return 0;
+}
diff --git a/progs/xdemos/vgears.c b/progs/xdemos/vgears.c
deleted file mode 100644
index f579e8b421d..00000000000
--- a/progs/xdemos/vgears.c
+++ /dev/null
@@ -1,281 +0,0 @@
-
-/*
- * Spinning gears demo for Linux SVGA/Mesa interface in 32K color mode.
- *
- * Compile with: gcc vgears.c -I../include -L../lib -lMesaGL -lX11 -lXext
- * -lvga -lm -o vgears
- *
- * This program is in the public domain.
- * Brian Paul, January 1996
- */
-
-
-#include <vga.h>
-#include <math.h>
-#include "GL/svgamesa.h"
-#include "GL/gl.h"
-
-
-int width = 800, height = 600;
-
-SVGAMesaContext vmc;
-
-
-
-/*
- * Draw a gear wheel. You'll probably want to call this function when
- * building a display list since we do a lot of trig here.
- *
- * Input: inner_radius - radius of hole at center
- * outer_radius - radius at center of teeth
- * width - width of gear
- * teeth - number of teeth
- * tooth_depth - depth of tooth
- */
-static void gear( GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
- GLint teeth, GLfloat tooth_depth )
-{
- GLint i;
- GLfloat r0, r1, r2;
- GLfloat angle, da;
- GLfloat u, v, len;
-
- r0 = inner_radius;
- r1 = outer_radius - tooth_depth/2.0;
- r2 = outer_radius + tooth_depth/2.0;
-
- da = 2.0*M_PI / teeth / 4.0;
-
- glShadeModel( GL_FLAT );
-
- glNormal3f( 0.0, 0.0, 1.0 );
-
- /* draw front face */
- glBegin( GL_QUAD_STRIP );
- for (i=0;i<=teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
- glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
- glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
- glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
- }
- glEnd();
-
- /* draw front sides of teeth */
- glBegin( GL_QUADS );
- da = 2.0*M_PI / teeth / 4.0;
- for (i=0;i<teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
-
- glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
- glVertex3f( r2*cos(angle+da), r2*sin(angle+da), width*0.5 );
- glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
- }
- glEnd();
-
-
- glNormal3f( 0.0, 0.0, -1.0 );
-
- /* draw back face */
- glBegin( GL_QUAD_STRIP );
- for (i=0;i<=teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
- glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
- glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
- glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
- }
- glEnd();
-
- /* draw back sides of teeth */
- glBegin( GL_QUADS );
- da = 2.0*M_PI / teeth / 4.0;
- for (i=0;i<teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
-
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
- glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
- glVertex3f( r2*cos(angle+da), r2*sin(angle+da), -width*0.5 );
- glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
- }
- glEnd();
-
-
- /* draw outward faces of teeth */
- glBegin( GL_QUAD_STRIP );
- for (i=0;i<teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
-
- glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
- glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
- u = r2*cos(angle+da) - r1*cos(angle);
- v = r2*sin(angle+da) - r1*sin(angle);
- len = sqrt( u*u + v*v );
- u /= len;
- v /= len;
- glNormal3f( v, -u, 0.0 );
- glVertex3f( r2*cos(angle+da), r2*sin(angle+da), width*0.5 );
- glVertex3f( r2*cos(angle+da), r2*sin(angle+da), -width*0.5 );
- glNormal3f( cos(angle), sin(angle), 0.0 );
- glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
- glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
- u = r1*cos(angle+3*da) - r2*cos(angle+2*da);
- v = r1*sin(angle+3*da) - r2*sin(angle+2*da);
- glNormal3f( v, -u, 0.0 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
- glNormal3f( cos(angle), sin(angle), 0.0 );
- }
-
- glVertex3f( r1*cos(0), r1*sin(0), width*0.5 );
- glVertex3f( r1*cos(0), r1*sin(0), -width*0.5 );
-
- glEnd();
-
-
- glShadeModel( GL_SMOOTH );
-
- /* draw inside radius cylinder */
- glBegin( GL_QUAD_STRIP );
- for (i=0;i<=teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
- glNormal3f( -cos(angle), -sin(angle), 0.0 );
- glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
- glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
- }
- glEnd();
-
-}
-
-
-static GLfloat view_rotx=20.0, view_roty=30.0, view_rotz=0.0;
-static GLint gear1, gear2, gear3;
-static GLfloat angle = 0.0;
-
-static GLuint limit;
-static GLuint count = 1;
-
-
-static void draw( void )
-{
- angle += 2.0;
-
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef( view_rotx, 1.0, 0.0, 0.0 );
- glRotatef( view_roty, 0.0, 1.0, 0.0 );
- glRotatef( view_rotz, 0.0, 0.0, 1.0 );
-
- glPushMatrix();
- glTranslatef( -3.0, -2.0, 0.0 );
- glRotatef( angle, 0.0, 0.0, 1.0 );
- glCallList(gear1);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef( 3.1, -2.0, 0.0 );
- glRotatef( -2.0*angle-9.0, 0.0, 0.0, 1.0 );
- glCallList(gear2);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef( -3.1, 4.2, 0.0 );
- glRotatef( -2.0*angle-25.0, 0.0, 0.0, 1.0 );
- glCallList(gear3);
- glPopMatrix();
-
- glPopMatrix();
-
- SVGAMesaSwapBuffers();
-}
-
-
-static void init( void )
-{
- static GLfloat pos[4] = {5.0, 5.0, 10.0, 1.0 };
- static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0 };
- static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0 };
- static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0 };
-
- GLfloat w = (float) width / (float) height;
- GLfloat h = 1.0;
-
- glLightfv( GL_LIGHT0, GL_POSITION, pos );
- glEnable( GL_CULL_FACE );
- glEnable( GL_LIGHTING );
- glEnable( GL_LIGHT0 );
- glEnable( GL_DEPTH_TEST );
-
- /* make the gears */
- gear1 = glGenLists(1);
- glNewList(gear1, GL_COMPILE);
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red );
- gear( 1.0, 4.0, 1.0, 20, 0.7 );
- glEndList();
-
- gear2 = glGenLists(1);
- glNewList(gear2, GL_COMPILE);
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green );
- gear( 0.5, 2.0, 2.0, 10, 0.7 );
- glEndList();
-
- gear3 = glGenLists(1);
- glNewList(gear3, GL_COMPILE);
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue );
- gear( 1.3, 2.0, 0.5, 10, 0.7 );
- glEndList();
-
- glEnable( GL_NORMALIZE );
-
-
- glViewport( 0, 0, width, height );
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- if (width>height) {
- GLfloat w = (GLfloat) width / (GLfloat) height;
- glFrustum( -w, w, -1.0, 1.0, 5.0, 60.0 );
- }
- else {
- GLfloat h = (GLfloat) height / (GLfloat) width;
- glFrustum( -1.0, 1.0, -h, h, 5.0, 60.0 );
- }
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -40.0 );
-}
-
-void setup( void )
-{
- vga_init();
-
- vga_setmode(G800x600x32K);
-/* gl_setcontextvga(G800x600x32K);*/
-
- vmc = SVGAMesaCreateContext(GL_TRUE);
- SVGAMesaMakeCurrent( vmc );
-}
-
-
-void end( void )
-{
- SVGAMesaDestroyContext( vmc );
-
- vga_setmode( TEXT );
-}
-
-
-int main( int argc, char *argv[] )
-{
- int i;
-
- setup();
- init();
- for (i=0;i<4;i++) {
- draw(); /*SVGAMesaSwapBuffers();*/
- }
- end();
- return 0;
-}
diff --git a/progs/xdemos/vindex.c b/progs/xdemos/vindex.c
deleted file mode 100644
index 991fce2a591..00000000000
--- a/progs/xdemos/vindex.c
+++ /dev/null
@@ -1,65 +0,0 @@
-
-/*
- * Test Linux 8-bit SVGA/Mesa color index mode
- *
- * Compile with: gcc vindex.c -I../include -L../lib -lMesaGL -lX11 -lXext
- * -lvga -lm -o vindex
- *
- * This program is in the public domain.
- * Brian Paul, January 1996
- */
-
-
-
-#include <vga.h>
-#include "GL/svgamesa.h"
-#include "GL/gl.h"
-
-
-
-static GLint width = 640, height = 480;
-
-
-
-static void display( void )
-{
- int i, j;
- int w, h;
-
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho( 0.0, (GLfloat) width, 0.0, (GLfloat) height, -1.0, 1.0 );
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- w = width / 16;
- h = height / 16;
- for (i=0;i<16;i++) {
- for (j=0;j<16;j++) {
- glIndexi( i*16+j );
- glRecti( i*w, j*h, i*w+w, j*h+h );
- }
- }
-}
-
-
-
-int main( int argc, char *argv[] )
-{
- SVGAMesaContext vmc;
- int i;
-
- vga_init();
- vga_setmode( G640x480x256 );
-
- vmc = SVGAMesaCreateContext( GL_FALSE );
- SVGAMesaMakeCurrent( vmc );
-
- display();
- sleep(3);
-
- SVGAMesaDestroyContext( vmc );
- vga_setmode( TEXT );
- return 0;
-}
diff --git a/progs/xdemos/vtest.c b/progs/xdemos/vtest.c
deleted file mode 100644
index e322fbc5c80..00000000000
--- a/progs/xdemos/vtest.c
+++ /dev/null
@@ -1,82 +0,0 @@
-
-/*
- * Test SVGA/Mesa interface in 32K color mode.
- *
- * Compile with: gcc vtest.c -I../include -L../lib -lMesaGL -lX11 -lXext
- * -lvga -lm -o vtest
- *
- * This program is in the public domain.
- * Brian Paul, January 1996
- */
-
-
-
-#include <vga.h>
-#include "GL/svgamesa.h"
-#include "GL/gl.h"
-
-
-SVGAMesaContext vmc;
-
-
-
-void setup( void )
-{
- vga_init();
-
- vga_setmode(G800x600x32K);
-/* gl_setcontextvga(G800x600x32K);*/
-
- vmc = SVGAMesaCreateContext( GL_FALSE ); /* single buffered */
- SVGAMesaMakeCurrent( vmc );
-}
-
-
-void test( void )
-{
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
- glMatrixMode(GL_MODELVIEW);
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- glBegin( GL_LINES );
- glColor3f( 1.0, 0.0, 0.0 );
- glVertex2f( -0.5, 0.5 );
- glVertex2f( 0.5, 0.5 );
- glColor3f( 0.0, 1.0, 0.0 );
- glVertex2f( -0.5, 0.25 );
- glVertex2f( 0.5, 0.25 );
- glColor3f( 0.0, 0.0, 1.0 );
- glVertex2f( -0.5, 0.0 );
- glVertex2f( 0.5, 0.0 );
- glEnd();
-
- glBegin( GL_POLYGON );
- glColor3f( 1.0, 0.0, 0.0 );
- glVertex2f( 0.0, 0.7 );
- glColor3f( 0.0, 1.0, 0.0 );
- glVertex2f( -0.5, -0.5 );
- glColor3f( 0.0, 0.0, 1.0 );
- glVertex2f( 0.5, -0.5 );
- glEnd();
-
- sleep(3);
-}
-
-void end( void )
-{
- SVGAMesaDestroyContext( vmc );
-
- vga_setmode( TEXT );
-}
-
-
-int main( int argc, char *argv[] )
-{
- setup();
- test();
- end();
- return 0;
-}