X11: drop suport for VOGL and old MESA in favour of OpenGL jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 14 Sep 2017 09:55:57 +0100
branchjv
changeset 8183 e1c6a2aa41b6
parent 8182 c730140a0156
child 8187 03ebf4f9a91d
X11: drop suport for VOGL and old MESA in favour of OpenGL Over years, OpenGL became widespread and implementations exist for all supported and soon-be-supported platforms using X11. This makes the code simpler and actually more portable. VOGL that has been used so far is no longer supported / maintained (I could not even find a source code).
GLXWorkstation.st
--- a/GLXWorkstation.st	Thu Sep 14 09:28:09 2017 +0100
+++ b/GLXWorkstation.st	Thu Sep 14 09:55:57 2017 +0100
@@ -24,40 +24,7 @@
 %{
 #include "stxOSDefs.h"
 
-/*
- * on SGI, this class is compiled with -DGLX, while
- * for simulation (using vogl), this is compiled with -DVGL
- *
- * New note: starting to support openGL (tm) (compile with -DOPENGL)
- * or its simulation (compile with -DMESA)
- */
-
-/*
- * SAD, SAD:
- *    on SGI, the GL library seems to come in different versions,
- *    some include the functions below, others dont.
- *    To avoid getting undefined symbol errors when linking, these
- *    functions are not included by default.
- *
- * enable the #define below (or compile with -DFULL_GLX) to enable
- * the following:
- *
- *    blendcolor getgconfig getmultisample leftbuffer rightbuffer monobuffer
- *    msalpha msmask mspattern mssize multisample stereobuffer
- *    t3s t3i t3f t3d t4s t4i t4f t4d tlutbind zbsize
- *
- * these are not available on all gl's
- */
-
-#ifdef GLX
-/* #define FULL_GLX */
-#endif
-
-/*
- * this is stupid, GLX type-defs String, which is also defined here ...
- * ... and xlib defines True and False
- * It might be a better idea, to completely separate GLX stuff from ST/X
- */
+
 #ifdef String
 # undef String
 #endif
@@ -111,39 +78,12 @@
 # include <signal.h>
 #endif
 
-#ifndef OPENGL
-# ifdef MESA
-#  define OPENGL
-# endif
-#endif
-
-#ifdef OPENGL   /* SGI or other OPENGL library */
-
-# include "GL/gl.h"
-# include "GL/glx.h"
-
-# ifdef MESA    /* GNU MESA openGL simulation */
-#  include "GL/xmesa.h"
-#  define OPENGLCONTEXT                         XMesaContext
-#  define GLXMAKECURRENT(dpy, draw, con)        XMesaMakeCurrent(con)
-# else
-   /* not yet known what else to include */
-#  define OPENGLCONTEXT GLXContext
-#  define GLXMAKECURRENT(dpy, draw, con)        glxMakeCurrent(dpy, draw, con)
-# endif
-
-#else
-
-# ifdef GLX     /* SGI native GL library */
-#  include <gl/glws.h>
-#  include <gl/sphere.h>
-# else          /* VOGL GL subset simulation */
-#  undef memset
-#  include <vogl.h>
-#  undef move
-#  include <X11/Xlib.h>
-# endif
-#endif
+#include "GL/gl.h"
+#include "GL/glx.h"
+
+#define OPENGLCONTEXT GLXContext
+#define GLXMAKECURRENT(dpy, draw, con)        glXMakeCurrent(dpy, draw, con)
+
 
 /*
  * XSGIStereo extension - if available
@@ -152,11 +92,6 @@
 # include <X11/extensions/SGIStereo.h>
 #endif
 
-#ifndef NULL
-# define NULL (char *)0         /* sigh */
-#endif
-
-
 typedef enum {
     GLXcolorIndexSingleBuffer,
     GLXcolorIndexDoubleBuffer,
@@ -184,11 +119,9 @@
  * which is distinct (?) from the windowID.
  * We dont want to add another instvar to View - do we ?
  */
-#if defined(OPENGL)
-
-# ifndef MAX_OPENGL_VIEWS
-#  define MAX_OPENGL_VIEWS      50
-# endif
+#ifndef MAX_OPENGL_VIEWS
+# define MAX_OPENGL_VIEWS      50
+#endif
 
 struct windowIDToGLContextMapping {
 	Window          win;
@@ -240,33 +173,19 @@
     }
 
 
-#else /* old GL */
-
-/*
- * set the GLXWindow for followup drawing
- */
-#define SETWIN(aGLXWindowId)                            \
-    {                                                   \
-	if (_INST(activeWindow) != aGLXWindowId) {      \
-	    if (! ISCONNECTED ) {                       \
-		RETURN (false);                         \
-	    }                                           \
-	    if (! __isExternalAddress(aGLXWindowId)) {  \
-		RETURN (false);                         \
-	    }                                           \
-	    if (GLXwinset(myDpy, _WindowVal(aGLXWindowId)) < 0) { \
-		RETURN (false);                         \
-	    }                                           \
-	    _INST(activeWindow) = aGLXWindowId;         \
-	    __STORE(self, aGLXWindowId);                \
-	} else {                                        \
-	    if (aGLXWindowId == nil) {                  \
-		RETURN (false);                         \
-	    }                                           \
-	}                                               \
-    }
-
-#endif /* old GL */
+
+
+#define Boolean        int
+#define TRUE           1
+#define FALSE          0
+#define Coord          float
+#define Icoord         int
+#define Scoord         int
+#define Colorindex     int
+#define Linestyle      int
+#define Offset         int
+#define Angle          int
+#define Screencoord    int
 
 /*
  * some defines - tired of typing ...
@@ -274,20 +193,6 @@
  * put/pack them into corresponding c variables.
  *
  */
-#ifdef OPENGL
-# define Boolean        int
-# define TRUE           1
-# define FALSE          0
-# define Coord          float
-# define Icoord         int
-# define Scoord         int
-# define Colorindex     int
-# define Linestyle      int
-# define Offset         int
-# define Angle          int
-# define Screencoord    int
-#endif
-
 #define myDpy              (Display *)(__MKCP(_INST(displayId)))
 #define ISCONNECTED        (_INST(displayId) != nil)
 #define _WindowVal(o)      (Window)(__MKCP(o))
@@ -430,10 +335,9 @@
  * before XWorkstation (which was not possible otherwise, due to unresolved
  * external references while loading this one)
  */
-static
-__XErrorHandler__(dpy, event)
-    Display *dpy;
-    XErrorEvent *event;
+static int
+__XErrorHandler__(Display *dpy, XErrorEvent *event)
+    ;
 {
     XGetErrorText(dpy, event->error_code, lastErrorMsg, 80);
     if (lastErrorMsg[0] == '\0') {
@@ -462,7 +366,7 @@
     return 0;
 }
 #else
-extern __XErrorHandler__();
+extern int __XErrorHandler__(Display *dpy, XErrorEvent *event);
 #endif
 
 /*