]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_glx.c
default to 640x480x16 again, just for consistency with other engines
[xonotic/darkplaces.git] / vid_glx.c
index de6c7c443df1a83568b12b1b952bc1e0e5788cbe..706cb5fda9f8d34269efefaa1fdb30b6fd7f1d8c 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -40,6 +40,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "quakedef.h"
 
+int cl_available = true;
+
 //GLX prototypes
 XVisualInfo *(GLAPIENTRY *qglXChooseVisual)(Display *dpy, int screen, int *attribList);
 GLXContext (GLAPIENTRY *qglXCreateContext)(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
@@ -81,8 +83,6 @@ Atom wm_delete_window_atom;
 #define X_MASK (KEY_MASK | MOUSE_MASK | VisibilityChangeMask | StructureNotifyMask )
 
 
-viddef_t       vid;                            // global video state
-
 static qboolean                mouse_avail = true;
 static qboolean                mouse_active = false, usingmouse = false;
 static float   mouse_x, mouse_y;
@@ -634,7 +634,14 @@ int VID_SetGamma(float prescale, float gamma, float scale, float base)
 #endif
 }
 
-void VID_Init(int fullscreen, int width, int height)
+void VID_Init(void)
+{
+       Cvar_RegisterVariable (&vid_dga);
+       Cvar_RegisterVariable (&vid_dga_mouseaccel);
+       InitSig(); // trap evil signals
+}
+
+int VID_InitMode(int fullscreen, int width, int height, int bpp)
 {
        int i;
 // LordHavoc: FIXME: finish this code, we need to allocate colors before we can store them
@@ -668,15 +675,15 @@ void VID_Init(int fullscreen, int width, int height)
        int MajorVersion, MinorVersion;
 
        if (!GL_OpenLibrary("libGL.so.1"))
-               Sys_Error("Unable to load GL driver\n");
-
-       Cvar_RegisterVariable (&vid_dga);
-       Cvar_RegisterVariable (&vid_dga_mouseaccel);
+       {
+               Con_Printf("Unable to load GL driver\n");
+               return false;
+       }
 
        if (!(vidx11_display = XOpenDisplay(NULL)))
        {
-               fprintf(stderr, "Error couldn't open the X display\n");
-               exit(1);
+               Con_Printf("Couldn't open the X display\n");
+               return false;
        }
 
        scrnum = DefaultScreen(vidx11_display);
@@ -697,7 +704,10 @@ void VID_Init(int fullscreen, int width, int height)
         || (qglXMakeCurrent = GL_GetProcAddress("glXMakeCurrent")) == NULL
         || (qglXSwapBuffers = GL_GetProcAddress("glXSwapBuffers")) == NULL
         || (qglXQueryExtensionsString = GL_GetProcAddress("glXQueryExtensionsString")) == NULL)
-               Sys_Error("glX functions not found in %s\n", gl_driver);
+       {
+               Con_Printf("glX functions not found in %s\n", gl_driver);
+               return false;
+       }
 
        visinfo = NULL;
 // LordHavoc: FIXME: finish this code, we need to allocate colors before we can store them
@@ -710,8 +720,8 @@ void VID_Init(int fullscreen, int width, int height)
                visinfo = qglXChooseVisual(vidx11_display, scrnum, nogammaattrib);
                if (!visinfo)
                {
-                       Sys_Error("couldn't get an RGB, Double-buffered, Depth visual\n");
-                       exit(1);
+                       Con_Printf("Couldn't get an RGB, Double-buffered, Depth visual\n");
+                       return false;
                }
        }
 
@@ -822,13 +832,9 @@ void VID_Init(int fullscreen, int width, int height)
        GL_CheckExtension("GLX_ARB_get_proc_address", getprocaddressfuncs, "-nogetprocaddress", false);
        gl_videosyncavailable = GL_CheckExtension("GLX_SGI_video_sync", videosyncfuncs, "-novideosync", false);
 
-       InitSig(); // trap evil signals
-
        vid_hidden = false;
-
        GL_Init();
-
-       Con_SafePrintf ("Video mode %dx%d initialized.\n", width, height);
+       return true;
 }
 
 void Sys_SendKeyEvents(void)