void GLimp_Shutdown() { if ( dpy ) { Sys_XUninstallGrabs(); GLimp_RestoreGamma(); qglXDestroyContext( dpy, ctx ); #if !defined( ID_GL_HARDLINK ) GLimp_dlclose(); #endif XDestroyWindow( dpy, win ); if ( vidmode_active ) { XF86VidModeSwitchToMode( dpy, scrnum, vidmodes[0] ); } XFlush( dpy ); // FIXME: that's going to crash //XCloseDisplay( dpy ); vidmode_active = false; dpy = NULL; win = 0; ctx = NULL; } }
/* ** GLimp_Shutdown ** ** This routine does all OS specific shutdown procedures for the OpenGL ** subsystem. Under OpenGL this means NULLing out the current DC and ** HGLRC, deleting the rendering context, and releasing the DC acquired ** for the window. The state structure is also nulled out. ** */ void GLimp_Shutdown( void ) { if (!ctx || !dpy) return; IN_DeactivateMouse(); // bk001206 - replaced with H2/Fakk2 solution // XAutoRepeatOn(dpy); // autorepeaton = qfalse; // bk001130 - from cvs1.17 (mkv) if (dpy) { if (ctx) qglXDestroyContext(dpy, ctx); if (win) XDestroyWindow(dpy, win); if (vidmode_active) XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[0]); XCloseDisplay(dpy); } vidmode_active = qfalse; dpy = NULL; win = 0; ctx = NULL; memset( &glConfig, 0, sizeof( glConfig ) ); memset( &glState, 0, sizeof( glState ) ); QGL_Shutdown(); }
/* ** GLimp_Shutdown ** ** This routine does all OS specific shutdown procedures for the OpenGL ** subsystem. Under OpenGL this means NULLing out the current DC and ** HGLRC, deleting the rendering context, and releasing the DC acquired ** for the window. The state structure is also nulled out. ** */ void GLimp_Shutdown( void ) { if (!ctx || !dpy) return; IN_DeactivateMouse(); XAutoRepeatOn(dpy); if (dpy) { if (ctx) qglXDestroyContext(dpy, ctx); if (win) XDestroyWindow(dpy, win); if (vidmode_active) XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[0]); XCloseDisplay(dpy); } vidmode_active = qfalse; dpy = NULL; win = 0; ctx = NULL; memset( &glConfig, 0, sizeof( glConfig ) ); memset( &glState, 0, sizeof( glState ) ); QGL_Shutdown(); }
/* ** GLimp_Shutdown ** ** This routine does all OS specific shutdown procedures for the OpenGL ** subsystem. Under OpenGL this means NULLing out the current DC and ** HGLRC, deleting the rendering context, and releasing the DC acquired ** for the window. The state structure is also nulled out. ** */ void GLimp_Shutdown( void ) { #ifdef HAVE_GLES if (!g_EGLWindowSurface || !dpy) #else if ( !ctx || !dpy ) #endif { return; } IN_DeactivateMouse(); // bk001206 - replaced with H2/Fakk2 solution // XAutoRepeatOn(dpy); // autorepeaton = qfalse; // bk001130 - from cvs1.17 (mkv) if ( dpy ) { #ifdef HAVE_GLES eglMakeCurrent( g_EGLDisplay, NULL, NULL, EGL_NO_CONTEXT ); if (g_EGLContext) eglDestroyContext(g_EGLDisplay, g_EGLContext); if (g_EGLWindowSurface) eglDestroySurface(g_EGLDisplay, g_EGLWindowSurface); eglTerminate(g_EGLDisplay); #else if ( ctx ) { qglXDestroyContext( dpy, ctx ); } #endif if ( win ) { XDestroyWindow( dpy, win ); } if ( vidmode_active ) { XF86VidModeSwitchToMode( dpy, scrnum, vidmodes[0] ); } if ( glConfig.deviceSupportsGamma ) { XF86VidModeSetGamma( dpy, scrnum, &vidmode_InitialGamma ); } // NOTE TTimo opening/closing the display should be necessary only once per run // but it seems QGL_Shutdown gets called in a lot of occasion // in some cases, this XCloseDisplay is known to raise some X errors // ( show_bug.cgi?id=33 ) XCloseDisplay( dpy ); } vidmode_active = qfalse; dpy = NULL; win = 0; #ifdef HAVE_GLES g_EGLWindowSurface = NULL; g_EGLContext = NULL; g_EGLDisplay = NULL; #else ctx = NULL; #endif memset( &glConfig, 0, sizeof( glConfig ) ); memset( &glState, 0, sizeof( glState ) ); QGL_Shutdown(); }
/* ** GLimp_Shutdown ** ** This routine does all OS specific shutdown procedures for the OpenGL ** subsystem. Under OpenGL this means NULLing out the current DC and ** HGLRC, deleting the rendering context, and releasing the DC acquired ** for the window. The state structure is also nulled out. ** */ void GLimp_Shutdown( void ) { if (!ctx || !dpy) return; IN_DeactivateMouse(); // bk001206 - replaced with H2/Fakk2 solution // XAutoRepeatOn(dpy); // autorepeaton = qfalse; // bk001130 - from cvs1.17 (mkv) if (dpy) { if (ctx) qglXDestroyContext(dpy, ctx); if (win) XDestroyWindow(dpy, win); #ifdef HAVE_XF86DGA if (vidmode_active) XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[0]); if (glConfig.deviceSupportsGamma) { XF86VidModeSetGamma(dpy, scrnum, &vidmode_InitialGamma); } #endif /* HAVE_XF86DGA */ // NOTE TTimo opening/closing the display should be necessary only once per run // but it seems QGL_Shutdown gets called in a lot of occasion // in some cases, this XCloseDisplay is known to raise some X errors // ( https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=33 ) XCloseDisplay(dpy); } vidmode_active = qfalse; dpy = NULL; win = 0; ctx = NULL; memset( &glConfig, 0, sizeof( glConfig ) ); memset( &glState, 0, sizeof( glState ) ); QGL_Shutdown(); }