]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
added -gl_driver commandline option, and cleaned up some glX init stuff a bit
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 30 Sep 2002 00:55:17 +0000 (00:55 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 30 Sep 2002 00:55:17 +0000 (00:55 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2473 d7cf8633-e32d-0410-b094-e92efae38249

vid_glx.c

index 6ccbbc2ab4cde55d7bef491951a9ec1c88c62472..542690a6f8b6548b2b05f3bfef9e4eb7cafad47b 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -480,6 +480,7 @@ void VID_Shutdown(void)
        {
                uninstall_grabs();
 
+               // FIXME: glXDestroyContext here?
                if (vidmode_active)
                        XF86VidModeSwitchToMode(vidx11_display, scrnum, vidmodes[0]);
                if (win)
@@ -673,10 +674,15 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int stencil)
        Window root;
        XVisualInfo *visinfo;
        int MajorVersion, MinorVersion;
-       
-       if (!GL_OpenLibrary("libGL.so.1"))
+       const char *drivername;
+
+       drivername = "libGL.so.1";
+       i = COM_CheckParm("-gl_driver");
+       if (i && i < com_argc - 1)
+               drivername = com_argv[i + 1];
+       if (!GL_OpenLibrary(drivername))
        {
-               Con_Printf("Unable to load GL driver\n");
+               Con_Printf("Unable to load GL driver \"%s\"\n", drivername);
                return false;
        }
 
@@ -814,11 +820,16 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int stencil)
                XF86VidModeSetViewPort(vidx11_display, scrnum, 0, 0);
        }
 
-       XFlush(vidx11_display);
+       //XSync(vidx11_display, False);
 
        ctx = qglXCreateContext(vidx11_display, visinfo, NULL, True);
+       if (!ctx)
+               Sys_Error ("glXCreateContext failed\n");
+
+       if (!qglXMakeCurrent(vidx11_display, win, ctx))
+               Sys_Error ("glXMakeCurrent failed\n");
 
-       qglXMakeCurrent(vidx11_display, win, ctx);
+       XSync(vidx11_display, False);
 
        scr_width = width;
        scr_height = height;