From 70bd7f90c7dc5330df6154dba2d1743ed0f3ef00 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 30 Sep 2002 00:55:17 +0000 Subject: [PATCH] added -gl_driver commandline option, and cleaned up some glX init stuff a bit git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2473 d7cf8633-e32d-0410-b094-e92efae38249 --- vid_glx.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/vid_glx.c b/vid_glx.c index 6ccbbc2a..542690a6 100644 --- 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; -- 2.39.2