diff -Naur --exclude=CVS fbcon.old/Makefile.am fbcon/Makefile.am
--- fbcon.old/Makefile.am	2004-12-20 20:51:45.000000000 +0100
+++ fbcon/Makefile.am	2004-12-21 04:08:17.000000000 +0100
@@ -8,10 +8,12 @@
 FBCON_SRCS = 			\
 	SDL_fbkeys.h		\
 	SDL_fbvideo.h		\
-	SDL_fbelo.c \
-	SDL_fbelo.h \
+	SDL_fbelo.c 		\
+	SDL_fbelo.h 		\
 	SDL_fbevents.c		\
 	SDL_fbevents_c.h	\
+	SDL_fbgl.c 		\
+	SDL_fbgl_c.h 		\
 	SDL_fb3dfx.c		\
 	SDL_fb3dfx.h		\
 	SDL_fbmatrox.c		\
diff -Naur --exclude=CVS fbcon.old/miniglx.h fbcon/miniglx.h
--- fbcon.old/miniglx.h	1970-01-01 01:00:00.000000000 +0100
+++ fbcon/miniglx.h	2004-12-21 03:29:37.000000000 +0100
@@ -0,0 +1,450 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.1
+ *
+ * Copyright (C) 1999-2004  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.
+ */
+
+
+/**
+ * \file miniglx.h
+ * \brief Mini GLX interface functions.
+ * \author Brian Paul
+ *
+ * See comments miniglx.c for more information.
+ */
+
+#ifndef MINIGLX_H
+#define MINIGLX_H
+
+#include <GL/gl.h>
+#include <stdlib.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * \name Replacement Xlib/GLX types
+ */
+/*@{*/
+/**
+ * \brief Boolean type.
+ * 
+ * It can have the values #True or #False.
+ */
+typedef int Bool;
+
+/**
+ * \brief Color map.
+ *
+ * Alias for private ::MiniGLXColormapRec structure.
+ */
+typedef struct MiniGLXColormapRec *Colormap;
+
+/**
+ * \brief Window attributes.
+ */
+typedef struct MiniGLXSetWindowAttributesRec {
+   int background_pixel; /**< \brief background pixel */
+   int border_pixel;     /**< \brief border pixel value */
+   Colormap colormap;    /**< \brief color map to be associated with window */
+   int event_mask;       /**< \brief set of events that should be saved */
+} XSetWindowAttributes;
+
+/**
+ * \brief Visual.
+ *
+ * Alias for the private ::MiniGLXVisualRec structure.
+ *
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXVisualRec Visual;
+
+/**
+ * \brief Visual information.
+ *
+ * \sa \ref datatypes.
+ */
+typedef unsigned int VisualID;
+typedef struct MiniGLXXVisualInfoRec {
+   Visual *visual;	/**< \brief pointer to the GLX Visual */
+   VisualID visualid;	/**< \brief visual ID */
+   int screen;		/**< \brief screen number */
+   int depth;		/**< \brief bit depth */
+#if defined(__cplusplus) || defined(c_plusplus)
+   int c_class;		/**< \brief class */
+#else
+   int class;		/**< \brief class */
+#endif
+   int bits_per_rgb;	/**< \brief total bits per pixel */
+} XVisualInfo;
+
+/**
+ * \brief GLX Frame Buffer Configuration (for pbuffers)
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXFBConfigRec {
+   XVisualInfo *visInfo;
+} GLXFBConfig;
+
+
+/**
+ * \brief Display handle.
+ *
+ * Alias for the private ::MiniGLXDisplayRec structure.
+ *
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXDisplayRec   Display;
+
+/**
+ * \brief Window handle.
+ *
+ * Alias for the private ::MiniGLXWindowRec structure.
+ *
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXWindowRec   *Window;
+
+/**
+ * \brief Drawable.
+ *
+ * Alias for the private ::MiniGLXWindowRec structure.
+ * 
+ * For Mini GLX only the full-screen window can be used as source and
+ * destination in graphics operations.
+ *
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXWindowRec   *Drawable;
+
+/**
+ * \brief GLX drawable.
+ *
+ * Alias for the private ::MiniGLXWindowRec structure.
+ * 
+ * Same as #Drawable.
+ *
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXWindowRec   *GLXDrawable;
+
+/**
+ * \brief GLX pbuffer.
+ *
+ * Alias for the private ::MiniGLXWindowRec structure.
+ * 
+ * Same as #Drawable.
+ *
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXWindowRec   *GLXPbuffer;
+
+/**
+ * \brief GLX context.
+ * 
+ * Alias for the private ::MiniGLXContext structure.
+ *
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXContextRec  *GLXContext;
+/*@}*/
+
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window window;
+	int x, y;
+	int width, height;
+	int count;		/* if non-zero, at least this many more */
+} XExposeEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window parent;		/* parent of the window */
+	Window window;		/* window id of window created */
+	int x, y;		/* window location */
+	int width, height;	/* size of window */
+	int border_width;	/* border width */
+	Bool override_redirect;	/* creation should be overridden */
+} XCreateWindowEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window event;
+	Window window;
+} XDestroyWindowEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window event;
+	Window window;
+	Bool from_configure;
+} XUnmapEvent;
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window event;
+	Window window;
+	Bool override_redirect;	/* boolean, is override set... */
+} XMapEvent;
+
+
+typedef struct {
+	int type;
+	unsigned long serial;	/* # of last request processed by server */
+	Bool send_event;	/* true if this came from a SendEvent request */
+	Display *display;	/* Display the event was read from */
+	Window parent;
+	Window window;
+} XMapRequestEvent;
+
+typedef union _XEvent {
+        int type;		/* must not be changed; first element */
+	XExposeEvent xexpose;
+        XCreateWindowEvent xcreatewindow;
+	XDestroyWindowEvent xdestroywindow;
+	XUnmapEvent xunmap;
+	XMapEvent xmap;
+	XMapRequestEvent xmaprequest;
+	long pad[24];
+} XEvent;
+
+
+/**
+ * \name Xlib constants
+ */
+/*@{*/
+#define False                0
+#define True                 1
+#define None                 0
+#define AllocNone            0
+#define InputOutput          1
+#define ExposureMask         (1L<<15) 
+#define StructureNotifyMask  (1L<<17) 
+#define CWBackPixel          (1L<<1)
+#define CWBorderPixel        (1L<<3)
+#define CWEventMask          (1L<<11)
+#define CWColormap           (1L<<13)
+#define PseudoColor          3
+#define TrueColor            4
+#define VisualScreenMask     0x2
+#define Expose		     12
+#define CreateNotify	     16
+#define DestroyNotify	     17
+#define UnmapNotify	     18
+#define MapNotify	     19
+#define MapRequest	     20
+
+/*@}*/
+
+/**
+ * \name Standard GLX tokens
+ */
+/*@{*/
+#define GLX_USE_GL		1
+#define GLX_BUFFER_SIZE		2
+#define GLX_LEVEL		3
+#define GLX_RGBA		4
+#define GLX_DOUBLEBUFFER	5
+#define GLX_STEREO		6
+#define GLX_AUX_BUFFERS		7
+#define GLX_RED_SIZE		8
+#define GLX_GREEN_SIZE		9
+#define GLX_BLUE_SIZE		10
+#define GLX_ALPHA_SIZE		11
+#define GLX_DEPTH_SIZE		12
+#define GLX_STENCIL_SIZE	13
+#define GLX_ACCUM_RED_SIZE	14
+#define GLX_ACCUM_GREEN_SIZE	15
+#define GLX_ACCUM_BLUE_SIZE	16
+#define GLX_ACCUM_ALPHA_SIZE	17
+#define GLX_BAD_ATTRIBUTE       1
+#define GLX_BAD_VISUAL          4
+/*@}*/
+
+
+/**
+ * \name Unique to Mini GLX
+ *
+ * At compile time, the Mini GLX interface version can be tested with the
+ * MINI_GLX_VERSION_1_x preprocessor tokens.
+ *
+ * \sa glXQueryVersion()
+ */
+/*@{*/
+/** \brief Defined if version 1.0 of Mini GLX is supported. */
+#define MINI_GLX_VERSION_1_0    1
+/** \brief Defined if version 1.1 of Mini GLX is supported. */
+#define MINI_GLX_VERSION_1_1    1
+/*@}*/
+
+
+/**
+ * \name Server-specific functions
+ */
+extern Display *
+__miniglx_StartServer( const char *display_name );
+
+extern int
+__miniglx_Select( Display *dpy, int maxfd,
+		  fd_set *rfds, fd_set *wfds, fd_set *xfds,
+		  struct timeval *tv );
+
+
+/**
+ * \name Simulated Xlib functions
+ */
+/*@{*/
+extern Display *
+XOpenDisplay( const char *dpy_name );
+
+
+extern void
+XCloseDisplay( Display *display );
+
+extern Window
+XCreateWindow( Display *display, Window parent, int x, int y,
+               unsigned int width, unsigned int height,
+               unsigned int border_width, int depth, unsigned int winclass,
+               Visual *visual, unsigned long valuemask,
+               XSetWindowAttributes *attributes );
+
+extern int 
+XNextEvent(Display *display, XEvent *event_return);
+
+extern Bool 
+XCheckMaskEvent( Display *dpy, long event_mask, XEvent *event_return );
+
+/**
+ * \brief Return the root window.
+ * 
+ * \param display the display handle. It is ignored by Mini GLX, but should be
+ * the value returned by XOpenDisplay().
+ * \param screen the screen number on the host server. It is ignored by Mini
+ * GLX but should be zero.
+ *
+ * \return the root window. Always zero on Mini GLX.
+ */
+#define RootWindow(display, screen) 0
+#define DefaultScreen(dpy)  0
+
+extern void
+XDestroyWindow( Display *display, Window w );
+
+extern void
+XMapWindow( Display *display, Window w );
+
+/* Should clients have access to this?
+ */
+extern void
+XUnmapWindow( Display *display, Window w );
+
+extern Colormap
+XCreateColormap( Display *display, Window w, Visual *visual, int alloc );
+
+extern void
+XFreeColormap( Display *display, Colormap cmap );
+
+extern void
+XFree( void *data );
+
+extern XVisualInfo *
+XGetVisualInfo( Display *display, long vinfo_mask,
+                XVisualInfo *vinfo_template, int *nitems_return );
+/*@}*/
+
+
+
+/**
+ * \name GLX functions
+ */
+/*@{*/
+extern XVisualInfo*
+glXChooseVisual( Display *dpy, int screen, int *attribList );
+
+extern int
+glXGetConfig( Display *dpy, XVisualInfo *vis, int attrib, int *value );
+
+extern GLXContext
+glXCreateContext( Display *dpy, XVisualInfo *vis,
+                  GLXContext shareList, Bool direct );
+
+extern void
+glXDestroyContext( Display *dpy, GLXContext ctx );
+
+extern Bool
+glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx);
+
+extern void
+glXSwapBuffers( Display *dpy, GLXDrawable drawable );
+
+extern GLXContext
+glXGetCurrentContext( void );
+
+extern GLXDrawable
+glXGetCurrentDrawable( void );
+
+extern void 
+(*glXGetProcAddress(const GLubyte *procname))( void );
+
+extern Bool
+glXQueryVersion( Display *dpy, int *major, int *minor );
+
+/* Added in MiniGLX 1.1 */
+extern GLXPbuffer
+glXCreatePbuffer( Display *dpy, GLXFBConfig config, const int *attribList );
+
+extern void
+glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
+
+extern GLXFBConfig *
+glXChooseFBConfig( Display *dpy, int screen, const int *attribList,
+                   int *nitems );
+
+extern XVisualInfo *
+glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config );
+
+/*@}*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MINIGLX_H */
diff -Naur --exclude=CVS fbcon.old/SDL_fbgl.c fbcon/SDL_fbgl.c
--- fbcon.old/SDL_fbgl.c	1970-01-01 01:00:00.000000000 +0100
+++ fbcon/SDL_fbgl.c	2004-12-21 04:17:31.000000000 +0100
@@ -0,0 +1,241 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2004 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+/*
+ * OpenGL over miniglx code implemented by
+ * Stephane Marchesin (stephane.marchesin@wanadoo.fr)
+ */
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id: SDL_fbgl.c,v 1.8 2004/01/04 16:49:27 slouken Exp $";
+#endif
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "SDL.h"
+#include "SDL_sysvideo.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+#include "SDL_fbvideo.h"
+#include "SDL_fbgl_c.h"
+
+
+int FB_GL_CreateWindow(_THIS, unsigned int width, unsigned int height)
+{
+	int visAttributes[32];
+	int i;
+
+	i=0;
+	visAttributes[i++] = GLX_RGBA;
+	visAttributes[i++] = GLX_RED_SIZE;
+	visAttributes[i++] = this->gl_config.red_size;
+	visAttributes[i++] = GLX_GREEN_SIZE;
+	visAttributes[i++] = this->gl_config.green_size;
+	visAttributes[i++] = GLX_BLUE_SIZE;
+	visAttributes[i++] = this->gl_config.blue_size;
+
+	if( this->gl_config.alpha_size ) {
+		visAttributes[i++] = GLX_ALPHA_SIZE;
+		visAttributes[i++] = this->gl_config.alpha_size;
+	}
+		
+	if( this->gl_config.buffer_size ) {
+		visAttributes[i++] = GLX_BUFFER_SIZE;
+		visAttributes[i++] = this->gl_config.buffer_size;
+	}
+
+	if( this->gl_config.double_buffer ) {
+		visAttributes[i++] = GLX_DOUBLEBUFFER;
+	}
+
+	visAttributes[i++] = GLX_DEPTH_SIZE;
+	visAttributes[i++] = this->gl_config.depth_size;
+
+	if( this->gl_config.stencil_size ) {
+		visAttributes[i++] = GLX_STENCIL_SIZE;
+		visAttributes[i++] = this->gl_config.stencil_size;
+	}
+
+	if( this->gl_config.accum_red_size ) {
+		visAttributes[i++] = GLX_ACCUM_RED_SIZE;
+		visAttributes[i++] = this->gl_config.accum_red_size;
+	}
+
+	if( this->gl_config.accum_green_size ) {
+		visAttributes[i++] = GLX_ACCUM_GREEN_SIZE;
+		visAttributes[i++] = this->gl_config.accum_green_size;
+	}
+
+	if( this->gl_config.accum_blue_size ) {
+		visAttributes[i++] = GLX_ACCUM_BLUE_SIZE;
+		visAttributes[i++] = this->gl_config.accum_blue_size;
+	}
+
+	if( this->gl_config.accum_alpha_size ) {
+		visAttributes[i++] = GLX_ACCUM_ALPHA_SIZE;
+		visAttributes[i++] = this->gl_config.accum_alpha_size;
+	}
+
+	visAttributes[i++] = None;
+
+	this->gl_data->dpy = XOpenDisplay(NULL);
+	if (!this->gl_data->dpy) {
+		printf("Error: XOpenDisplay failed\n");
+		return 1;
+	}
+
+
+	XSetWindowAttributes attr;
+	unsigned long attrMask;
+	Window root;
+	XVisualInfo *visinfo;
+
+	root = RootWindow(this->gl_data->dpy, 0);
+
+	/* Choose GLX visual / pixel format */
+	visinfo = glXChooseVisual(this->gl_data->dpy, 0, visAttributes);
+	if (!visinfo) {
+		printf("Error: couldn't get an RGB, Double-buffered visual\n");
+		return 1;
+	}
+
+	/* Create the window */
+	attr.background_pixel = 0;
+	attr.border_pixel = 0;
+	attr.colormap = XCreateColormap(this->gl_data->dpy, root, visinfo->visual, AllocNone);
+	attrMask = CWBackPixel | CWBorderPixel | CWColormap;
+	this->gl_data->win = XCreateWindow(this->gl_data->dpy, root, 0, 0, width, height,
+			0, visinfo->depth, InputOutput,
+			visinfo->visual, attrMask, &attr);
+	if (!this->gl_data->win) {
+		printf("Error: XCreateWindow failed\n");
+		return 1;
+	}
+
+	/* Display the window */
+	XMapWindow(this->gl_data->dpy, this->gl_data->win);
+
+	/* Create GLX rendering context */
+	this->gl_data->ctx = glXCreateContext(this->gl_data->dpy, visinfo, NULL, True);
+	if (!this->gl_data->ctx) {
+		printf("Error: glXCreateContext failed\n");
+		return 1;
+	}
+
+	/* Bind the rendering context and window */
+	glXMakeCurrent(this->gl_data->dpy, this->gl_data->win, this->gl_data->ctx);
+
+	glViewport(0, 0, width, height);
+
+	return 0;
+}
+
+
+
+void *FB_GL_GetProcAddress(_THIS, const char* proc)
+{
+	return NULL;
+}
+
+int FB_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
+{
+	GLenum attr = 0;
+
+	FB_GL_MakeCurrent (this);
+
+	switch (attrib) {
+		case SDL_GL_RED_SIZE: 
+			attr = GL_RED_BITS;   
+			break;
+		case SDL_GL_BLUE_SIZE: 
+			attr = GL_BLUE_BITS;  
+			break;
+		case SDL_GL_GREEN_SIZE: 
+			attr = GL_GREEN_BITS; 
+			break;
+		case SDL_GL_ALPHA_SIZE: 
+			attr = GL_ALPHA_BITS; 
+			break;
+		case SDL_GL_DOUBLEBUFFER: 
+			attr = GL_DOUBLEBUFFER; 
+			break;
+		case SDL_GL_DEPTH_SIZE: 
+			attr = GL_DEPTH_BITS;  
+			break;
+		case SDL_GL_STENCIL_SIZE: 
+			attr = GL_STENCIL_BITS; 
+			break;
+		case SDL_GL_ACCUM_RED_SIZE: 
+			attr = GL_ACCUM_RED_BITS; 
+			break;
+		case SDL_GL_ACCUM_GREEN_SIZE: 
+			attr = GL_ACCUM_GREEN_BITS; 
+			break;
+		case SDL_GL_ACCUM_BLUE_SIZE: 
+			attr = GL_ACCUM_BLUE_BITS; 
+			break;
+		case SDL_GL_ACCUM_ALPHA_SIZE: 
+			attr = GL_ACCUM_ALPHA_BITS; 
+			break;
+		case SDL_GL_STEREO: 
+			attr = GL_STEREO; 
+			break;
+		case SDL_GL_BUFFER_SIZE:
+		{
+			GLint bits = 0;
+			GLint component;
+
+			/* there doesn't seem to be a single flag in OpenGL for this! */
+			glGetIntegerv (GL_RED_BITS, &component);   bits += component;
+			glGetIntegerv (GL_GREEN_BITS,&component);  bits += component;
+			glGetIntegerv (GL_BLUE_BITS, &component);  bits += component;
+			glGetIntegerv (GL_ALPHA_BITS, &component); bits += component;
+
+			*value = bits;
+		}
+		return 0;
+		default:
+		return -1;
+	}
+
+	glGetIntegerv (attr, (GLint *)value);
+	return 0;
+}
+
+int FB_GL_MakeCurrent(_THIS)
+{
+	if (!glXMakeCurrent(this->gl_data->dpy, this->gl_data->win, this->gl_data->ctx))
+		return -1;
+	return 1;
+}
+
+void FB_GL_SwapBuffers(_THIS)
+{
+	glXSwapBuffers(this->gl_data->dpy, this->gl_data->win);
+}
+
+
+
diff -Naur --exclude=CVS fbcon.old/SDL_fbgl_c.h fbcon/SDL_fbgl_c.h
--- fbcon.old/SDL_fbgl_c.h	1970-01-01 01:00:00.000000000 +0100
+++ fbcon/SDL_fbgl_c.h	2005-09-13 23:55:14.660915000 +0200
@@ -0,0 +1,51 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2004 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+/*
+ * OpenGL over miniglx code implemented by
+ * Stephane Marchesin (stephane.marchesin@wanadoo.fr)
+ */
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id: SDL_fbgl_c.h,v 1.8 2004/01/04 16:49:27 slouken Exp $";
+#endif
+
+
+#include <GL/gl.h>
+#include "miniglx.h"
+#include "SDL_sysvideo.h"
+
+struct SDL_PrivateGLData {
+#ifdef HAVE_OPENGL
+	Display *dpy;
+	Window win;
+	GLXContext ctx;
+#endif /* HAVE_OPENGL */
+};
+
+extern int FB_GL_CreateWindow(_THIS, unsigned int width, unsigned int height);
+extern void *FB_GL_GetProcAddress(_THIS, const char* proc);
+extern int FB_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
+extern int FB_GL_MakeCurrent(_THIS);
+extern void FB_GL_SwapBuffers(_THIS);
+
diff -Naur --exclude=CVS fbcon.old/SDL_fbvideo.c fbcon/SDL_fbvideo.c
--- fbcon.old/SDL_fbvideo.c	2005-09-13 23:57:09.560915000 +0200
+++ fbcon/SDL_fbvideo.c	2005-09-13 23:56:38.450915000 +0200
@@ -1,6 +1,6 @@
 /*
 	SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2004 Sam Lantinga
+	Copyright (C) 1997-2004 Sam Lantinga
 
 	This library is free software; you can redistribute it and/or
 	modify it under the terms of the GNU Library General Public
@@ -50,6 +50,7 @@
 #include "SDL_fb3dfx.h"
 #include "SDL_fbmatrox.h"
 #include "SDL_fbriva.h"
+#include "SDL_fbgl_c.h"
 
 
 #if defined(i386) && defined(FB_TYPE_VGA_PLANES)
@@ -172,8 +173,15 @@
 
 static void FB_DeleteDevice(SDL_VideoDevice *device)
 {
-	free(device->hidden);
-	free(device);
+	if ( device ) {
+		if ( device->hidden ) {
+			free(device->hidden);
+		}
+		if ( device->gl_data ) {
+			free(device->gl_data);
+		}
+		free(device);
+	}
 }
 
 static SDL_VideoDevice *FB_CreateDevice(int devindex)
@@ -186,8 +194,11 @@
 		memset(this, 0, (sizeof *this));
 		this->hidden = (struct SDL_PrivateVideoData *)
 				malloc((sizeof *this->hidden));
+		this->gl_data = (struct SDL_PrivateGLData *)
+				malloc((sizeof *this->gl_data));
 	}
-	if ( (this == NULL) || (this->hidden == NULL) ) {
+	if ( (this == NULL) || (this->hidden == NULL) || 
+				(this->hidden == NULL)	) {
 		SDL_OutOfMemory();
 		if ( this ) {
 			free(this);
@@ -195,6 +206,7 @@
 		return(0);
 	}
 	memset(this->hidden, 0, (sizeof *this->hidden));
+	memset(this->gl_data, 0, (sizeof *this->gl_data));
 	wait_vbl = FB_WaitVBL;
 	wait_idle = FB_WaitIdle;
 	mouse_fd = -1;
@@ -224,6 +236,13 @@
 	this->InitOSKeymap = FB_InitOSKeymap;
 	this->PumpEvents = FB_PumpEvents;
 
+#ifdef HAVE_OPENGL      
+	this->GL_GetProcAddress = FB_GL_GetProcAddress;
+	this->GL_GetAttribute = FB_GL_GetAttribute;
+	this->GL_MakeCurrent = FB_GL_MakeCurrent;
+	this->GL_SwapBuffers = FB_GL_SwapBuffers;
+#endif
+
 	this->free = FB_DeleteDevice;
 
 	return this;
@@ -865,6 +884,11 @@
 	/* Set the update rectangle function */
 	this->UpdateRects = FB_DirectUpdate;
 
+	if ( flags & SDL_OPENGL ) {
+		if (FB_GL_CreateWindow(this,width,height))
+			return NULL;
+	}
+
 	/* We're done */
 	return(current);
 }
