summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Faye-Lund <erik.faye-lund@collabora.com>2023-03-13 08:01:40 +0100
committerErik Faye-Lund <erik.faye-lund@collabora.com>2023-03-14 16:30:24 +0000
commitf5085908a2778b7cc539758f21f3b3da9719b196 (patch)
tree2fa3a10e0411fa165021c04b144dcefa22e547b9
parent7a5bd8c71597e08f91291f9e2bb4750e2b6ba113 (diff)
downloadmesa-demos-f5085908a2778b7cc539758f21f3b3da9719b196.tar.gz
completely retire xmesa/fx code
This is ancient code that hasn't been hooked up to the build system since the conversion to autoconf, back in 2007. The code is here to support Mesa on Glide, which isn't something that hasn't been supported in Mesa since Mesa 7.2/3, released in 2009. We had a dummy implementation in Mesa that did nothing and always reported failure until 2017, but now even that is gone. It's about time to let this code go, as it has no chance to even build on new Mesa versions. Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
-rw-r--r--src/demos/fire.c11
-rw-r--r--src/demos/ipers.c12
-rw-r--r--src/demos/rain.cxx14
-rw-r--r--src/demos/ray.c14
-rw-r--r--src/demos/teapot.c11
-rw-r--r--src/demos/terrain.c16
-rw-r--r--src/demos/tunnel.c12
-rw-r--r--src/demos/tunnel2.c36
-rw-r--r--src/xdemos/xdemo.c334
9 files changed, 0 insertions, 460 deletions
diff --git a/src/demos/fire.c b/src/demos/fire.c
index 25b2fa29..05371986 100644
--- a/src/demos/fire.c
+++ b/src/demos/fire.c
@@ -21,11 +21,6 @@
#include "glut_wrap.h"
#include "readtex.h"
-#ifdef XMESA
-#include "GL/xmesa.h"
-static int fullscreen = 1;
-#endif
-
#ifndef M_PI
#define M_PI 3.1415926535
#endif
@@ -604,12 +599,6 @@ key(unsigned char key, int x, int y)
case 'T':
ridtri -= 0.005;
break;
-#ifdef XMESA
- case ' ':
- XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
- fullscreen = (!fullscreen);
- break;
-#endif
case 'n':
NiceFog = !NiceFog;
printf("NiceFog %d\n", NiceFog);
diff --git a/src/demos/ipers.c b/src/demos/ipers.c
index c939d9be..d7cd9e75 100644
--- a/src/demos/ipers.c
+++ b/src/demos/ipers.c
@@ -21,11 +21,6 @@
#include "readtex.h"
-#ifdef XMESA
-#include "GL/xmesa.h"
-static int fullscreen = 1;
-#endif
-
static int WIDTH = 640;
static int HEIGHT = 480;
@@ -273,13 +268,6 @@ key(unsigned char k, int x, int y)
v -= 0.01;
break;
-#ifdef XMESA
- case ' ':
- fullscreen = (!fullscreen);
- XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
- break;
-#endif
-
case '+':
LODbias--;
break;
diff --git a/src/demos/rain.cxx b/src/demos/rain.cxx
index 138da3c7..f87df891 100644
--- a/src/demos/rain.cxx
+++ b/src/demos/rain.cxx
@@ -26,11 +26,6 @@ extern "C" {
#include <mmsystem.h>
#endif
-#ifdef XMESA
-#include "GL/xmesa.h"
-static int fullscreen=1;
-#endif
-
static int WIDTH=640;
static int HEIGHT=480;
static int NUMPART=7500;
@@ -290,12 +285,6 @@ static void key(unsigned char key, int x, int y)
case 'f':
fog=(!fog);
break;
-#ifdef XMESA
- case ' ':
- XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
- fullscreen=(!fullscreen);
- break;
-#endif
}
}
@@ -377,9 +366,6 @@ int main(int ac,char **av)
glFogi(GL_FOG_MODE,GL_EXP);
glFogfv(GL_FOG_COLOR,fogcolor);
glFogf(GL_FOG_DENSITY,0.1);
-#ifdef FX
- glHint(GL_FOG_HINT,GL_NICEST);
-#endif
initparticle();
diff --git a/src/demos/ray.c b/src/demos/ray.c
index 8611b53b..7b70603d 100644
--- a/src/demos/ray.c
+++ b/src/demos/ray.c
@@ -17,11 +17,6 @@
#include "glut_wrap.h"
-#ifdef XMESA
-#include "GL/xmesa.h"
-static int fullscreen = 1;
-#endif
-
static int WIDTH = 640;
static int HEIGHT = 480;
@@ -226,12 +221,6 @@ key(unsigned char k, int x, int y)
poutline = 1;
}
break;
-#ifdef XMESA
- case ' ':
- XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
- fullscreen = (!fullscreen);
- break;
-#endif
}
}
@@ -881,9 +870,6 @@ main(int ac, char **av)
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.01);
-#ifdef FX
- glHint(GL_FOG_HINT, GL_NICEST);
-#endif
calcposobs();
diff --git a/src/demos/teapot.c b/src/demos/teapot.c
index e7bd8ac9..ab78c713 100644
--- a/src/demos/teapot.c
+++ b/src/demos/teapot.c
@@ -19,11 +19,6 @@
#include "glut_wrap.h"
#include "readtex.h"
-#ifdef XMESA
-#include "GL/xmesa.h"
-static int fullscreen=1;
-#endif
-
static int WIDTH=640;
static int HEIGHT=480;
@@ -218,12 +213,6 @@ static void key(unsigned char k, int x, int y)
bfcull=1;
}
break;
-#ifdef XMESA
- case ' ':
- XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
- fullscreen=(!fullscreen);
- break;
-#endif
}
}
diff --git a/src/demos/terrain.c b/src/demos/terrain.c
index 2362505e..03f80d6c 100644
--- a/src/demos/terrain.c
+++ b/src/demos/terrain.c
@@ -21,11 +21,6 @@
#include "glut_wrap.h"
-#ifdef XMESA
-#include "GL/xmesa.h"
-static int fullscreen = 1;
-#endif
-
#ifndef M_PI
#define M_PI 3.14159265
#endif
@@ -478,12 +473,6 @@ key(unsigned char k, int x, int y)
bfcull = 1;
}
break;
-#ifdef XMESA
- case ' ':
- XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
- fullscreen = (!fullscreen);
- break;
-#endif
}
}
@@ -617,9 +606,6 @@ init(void)
glFogi(GL_FOG_MODE, GL_EXP2);
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.0007);
-#ifdef FX
- glHint(GL_FOG_HINT, GL_NICEST);
-#endif
reshape(scrwidth, scrheight);
}
@@ -643,10 +629,8 @@ main(int ac, char **av)
init();
-#ifndef FX
glDisable(GL_TEXTURE_2D);
usetex = 0;
-#endif
glutReshapeFunc(reshape);
glutDisplayFunc(drawscene);
diff --git a/src/demos/tunnel.c b/src/demos/tunnel.c
index 91fe67e1..d36b74d9 100644
--- a/src/demos/tunnel.c
+++ b/src/demos/tunnel.c
@@ -19,11 +19,6 @@
#include "readtex.h"
#include "tunneldat.h"
-#ifdef XMESA
-#include "GL/xmesa.h"
-static int fullscreen = 1;
-#endif
-
static int WIDTH = 640;
static int HEIGHT = 480;
@@ -224,13 +219,6 @@ key(unsigned char k, int x, int y)
case 'z':
v -= 5.;
break;
-
-#ifdef XMESA
- case ' ':
- fullscreen = (!fullscreen);
- XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
- break;
-#endif
case 'j':
joyactive = (!joyactive);
break;
diff --git a/src/demos/tunnel2.c b/src/demos/tunnel2.c
index 0c7b1a64..dd064a2b 100644
--- a/src/demos/tunnel2.c
+++ b/src/demos/tunnel2.c
@@ -22,18 +22,6 @@
#include "readtex.h"
#include "tunneldat.h"
-#ifdef FX
-#endif
-
-#ifdef XMESA
-#include "GL/xmesa.h"
-static int fullscreen = 1;
-#endif
-
-#ifdef FX
-GLint fxMesaSelectCurrentBoard(int);
-#endif
-
static int WIDTHC0 = 640;
static int HEIGHTC0 = 480;
@@ -225,18 +213,6 @@ key(unsigned char k, int x, int y)
v -= 5.;
break;
-#ifdef XMESA
- case ' ':
- fullscreen = (!fullscreen);
-
- glutSetWindow(channel[0]);
- XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
-
- glutSetWindow(channel[1]);
- XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
- break;
-#endif
-
case 'j':
joyactive = (!joyactive);
break;
@@ -566,12 +542,6 @@ main(int ac, char **av)
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
-#ifdef FX
- if (fxMesaSelectCurrentBoard(0) < 0) {
- fprintf(stderr, "The first Voodoo Graphics board is missing !?!?\n");
- return -1;
- }
-#endif
if (!(channel[0] = glutCreateWindow("Channel 0"))) {
fprintf(stderr, "Error, couldn't open window\n");
return -1;
@@ -585,12 +555,6 @@ main(int ac, char **av)
glutKeyboardFunc(key);
glutSpecialFunc(special);
-#ifdef FX
- if (fxMesaSelectCurrentBoard(1) < 0) {
- fprintf(stderr, "The second Voodoo Graphics board is missing !\n");
- exit(-1);
- }
-#endif
glutInitWindowPosition(WIDTHC0, 0);
glutInitWindowSize(WIDTHC1, HEIGHTC1);
if (!(channel[1] = glutCreateWindow("Channel 1"))) {
diff --git a/src/xdemos/xdemo.c b/src/xdemos/xdemo.c
deleted file mode 100644
index 52039cb6..00000000
--- a/src/xdemos/xdemo.c
+++ /dev/null
@@ -1,334 +0,0 @@
-
-/*
- * Very simple demo of how to use the Mesa/X11 interface instead of the
- * glx, tk or aux toolkits. I highly recommend using the GLX interface
- * instead of the X/Mesa interface, however.
- *
- * This program is in the public domain.
- *
- * Brian Paul
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include "GL/xmesa.h"
-#include "GL/gl.h"
-
-
-
-static GLint Black, Red, Green, Blue;
-
-
-
-static void make_window( char *title, int color_flag )
-{
- int x = 10, y = 10, width = 400, height = 300;
- Display *dpy;
- int scr;
- Window root, win;
- Colormap cmap;
- XColor xcolor;
- int attr_flags;
- XVisualInfo *visinfo;
- XSetWindowAttributes attr;
- XTextProperty tp;
- XSizeHints sh;
- XEvent e;
- XMesaContext context;
- XMesaVisual visual;
- XMesaBuffer buffer;
-
-
- /*
- * Do the usual X things to make a window.
- */
-
- dpy = XOpenDisplay(NULL);
- if (!dpy) {
- printf("Couldn't open default display!\n");
- exit(1);
- }
-
- scr = DefaultScreen(dpy);
- root = RootWindow(dpy, scr);
-
- /* alloc visinfo struct */
- visinfo = (XVisualInfo *) malloc( sizeof(XVisualInfo) );
-
- /* Get a visual and colormap */
- if (color_flag) {
- /* Open TrueColor window */
-
-/*
- if (!XMatchVisualInfo( dpy, scr, 24, TrueColor, visinfo )) {
- printf("Couldn't get 24-bit TrueColor visual!\n");
- exit(1);
- }
-*/
- if (!XMatchVisualInfo( dpy, scr, 8, PseudoColor, visinfo )) {
- printf("Couldn't get 8-bit PseudoColor visual!\n");
- exit(1);
- }
-
- cmap = XCreateColormap( dpy, root, visinfo->visual, AllocNone );
- Black = Red = Green = Blue = 0;
- }
- else {
- /* Open color index window */
-
- if (!XMatchVisualInfo( dpy, scr, 8, PseudoColor, visinfo )) {
- printf("Couldn't get 8-bit PseudoColor visual\n");
- exit(1);
- }
-
- cmap = XCreateColormap( dpy, root, visinfo->visual, AllocNone );
-
- /* Allocate colors */
- xcolor.red = 0x0;
- xcolor.green = 0x0;
- xcolor.blue = 0x0;
- xcolor.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor( dpy, cmap, &xcolor )) {
- printf("Couldn't allocate black!\n");
- exit(1);
- }
- Black = xcolor.pixel;
-
- xcolor.red = 0xffff;
- xcolor.green = 0x0;
- xcolor.blue = 0x0;
- xcolor.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor( dpy, cmap, &xcolor )) {
- printf("Couldn't allocate red!\n");
- exit(1);
- }
- Red = xcolor.pixel;
-
- xcolor.red = 0x0;
- xcolor.green = 0xffff;
- xcolor.blue = 0x0;
- xcolor.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor( dpy, cmap, &xcolor )) {
- printf("Couldn't allocate green!\n");
- exit(1);
- }
- Green = xcolor.pixel;
-
- xcolor.red = 0x0;
- xcolor.green = 0x0;
- xcolor.blue = 0xffff;
- xcolor.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor( dpy, cmap, &xcolor )) {
- printf("Couldn't allocate blue!\n");
- exit(1);
- }
- Blue = xcolor.pixel;
- }
-
- /* set window attributes */
- attr.colormap = cmap;
- attr.event_mask = ExposureMask | StructureNotifyMask;
- attr.border_pixel = BlackPixel( dpy, scr );
- attr.background_pixel = BlackPixel( dpy, scr );
- attr_flags = CWColormap | CWEventMask | CWBorderPixel | CWBackPixel;
-
- /* Create the window */
- win = XCreateWindow( dpy, root, x,y, width, height, 0,
- visinfo->depth, InputOutput,
- visinfo->visual,
- attr_flags, &attr);
- if (!win) {
- printf("Couldn't open window!\n");
- exit(1);
- }
-
- XStringListToTextProperty(&title, 1, &tp);
- sh.flags = USPosition | USSize;
- XSetWMProperties(dpy, win, &tp, &tp, 0, 0, &sh, 0, 0);
- XMapWindow(dpy, win);
- while (1) {
- XNextEvent( dpy, &e );
- if (e.type == MapNotify && e.xmap.window == win) {
- break;
- }
- }
-
-
- /*
- * Now do the special Mesa/Xlib stuff!
- */
-
- visual = XMesaCreateVisual( dpy, visinfo,
- (GLboolean) color_flag,
- GL_FALSE, /* alpha_flag */
- GL_FALSE, /* db_flag */
- GL_FALSE, /* stereo flag */
- GL_FALSE, /* ximage_flag */
- 0, /* depth size */
- 0, /* stencil size */
- 0,0,0,0, /* accum_size */
- 0, /* num samples */
- 0, /* level */
- 0 /* caveat */
- );
- if (!visual) {
- printf("Couldn't create Mesa/X visual!\n");
- exit(1);
- }
-
- /* Create a Mesa rendering context */
- context = XMesaCreateContext( visual,
- NULL /* share_list */
- );
- if (!context) {
- printf("Couldn't create Mesa/X context!\n");
- exit(1);
- }
-
- buffer = XMesaCreateWindowBuffer( visual, win );
- if (!buffer) {
- printf("Couldn't create Mesa/X buffer!\n");
- exit(1);
- }
-
-
- XMesaMakeCurrent( context, buffer );
-
- /* Ready to render! */
-}
-
-
-
-static void draw_cube( void )
-{
- /* X faces */
- glIndexi( Red );
- glColor3f( 1.0, 0.0, 0.0 );
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, 1.0, 1.0 );
- glVertex3f( 1.0, -1.0, 1.0 );
- glVertex3f( 1.0, -1.0, -1.0 );
- glVertex3f( 1.0, 1.0, -1.0 );
- glEnd();
-
- glBegin( GL_POLYGON );
- glVertex3f( -1.0, 1.0, 1.0 );
- glVertex3f( -1.0, 1.0, -1.0 );
- glVertex3f( -1.0, -1.0, -1.0 );
- glVertex3f( -1.0, -1.0, 1.0 );
- glEnd();
-
- /* Y faces */
- glIndexi( Green );
- glColor3f( 0.0, 1.0, 0.0 );
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, 1.0, 1.0 );
- glVertex3f( 1.0, 1.0, -1.0 );
- glVertex3f( -1.0, 1.0, -1.0 );
- glVertex3f( -1.0, 1.0, 1.0 );
- glEnd();
-
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, -1.0, 1.0 );
- glVertex3f( -1.0, -1.0, 1.0 );
- glVertex3f( -1.0, -1.0, -1.0 );
- glVertex3f( 1.0, -1.0, -1.0 );
- glEnd();
-
- /* Z faces */
- glIndexi( Blue );
- glColor3f( 0.0, 0.0, 1.0 );
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, 1.0, 1.0 );
- glVertex3f( -1.0, 1.0, 1.0 );
- glVertex3f( -1.0, -1.0, 1.0 );
- glVertex3f( 1.0, -1.0, 1.0 );
- glEnd();
-
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, 1.0, -1.0 );
- glVertex3f( 1.0,-1.0, -1.0 );
- glVertex3f( -1.0,-1.0, -1.0 );
- glVertex3f( -1.0, 1.0, -1.0 );
- glEnd();
-}
-
-
-
-
-static void display_loop( void )
-{
- GLfloat xrot, yrot, zrot;
-
- xrot = yrot = zrot = 0.0;
-
- glClearColor( 0.0, 0.0, 0.0, 0.0 );
- glClearIndex( Black );
-
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 1.0, 10.0 );
- glTranslatef( 0.0, 0.0, -5.0 );
-
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-
- glCullFace( GL_BACK );
- glEnable( GL_CULL_FACE );
-
- glShadeModel( GL_FLAT );
-
- while (1) {
- 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 );
-
- draw_cube();
-
- glPopMatrix();
- glFinish();
-
- xrot += 10.0;
- yrot += 7.0;
- zrot -= 3.0;
- }
-
-}
-
-
-
-
-int main( int argc, char *argv[] )
-{
- int mode = 0;
-
- if (argc >= 2)
- {
- if (strcmp(argv[1],"-ci")==0)
- mode = 0;
- else if (strcmp(argv[1],"-rgb")==0)
- mode = 1;
- else
- {
- printf("Bad flag: %s\n", argv[1]);
- printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n");
- exit(1);
- }
- }
- else
- {
- printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n");
- printf("Defaulting to 8-bit color index\n");
- }
-
- make_window( argv[0], mode );
-
- display_loop();
- return 0;
-}
-