diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 8c10395..51367ae 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -201,6 +201,7 @@ MAKE_FUNCPTR(glXChooseVisual) MAKE_FUNCPTR(glXCreateContext) MAKE_FUNCPTR(glXCreateGLXPixmap) MAKE_FUNCPTR(glXGetCurrentContext) +MAKE_FUNCPTR(glXGetCurrentDrawable) MAKE_FUNCPTR(glXDestroyContext) MAKE_FUNCPTR(glXDestroyGLXPixmap) MAKE_FUNCPTR(glXGetConfig) @@ -254,6 +255,9 @@ BOOL X11DRV_WineGL_InitOpenglInfo() XVisualInfo *vis; int num; GLXContext ctx = NULL; + GLXContext oldctx; + Window oldwin; + BOOL ret = FALSE; if (infoInitialized) return TRUE; @@ -270,10 +274,15 @@ BOOL X11DRV_WineGL_InitOpenglInfo() } if (ctx) { + /* save current context and drawable */ + oldctx = pglXGetCurrentContext(); + oldwin = pglXGetCurrentDrawable(); + + /* use context we created */ pglXMakeCurrent(gdi_display, win, ctx); } else { ERR(" couldn't initialize OpenGL, expect problems\n"); - return FALSE; + goto unable_to_init_ogl; } WineGLInfo.glVersion = (const char *) pglGetString(GL_VERSION); @@ -297,10 +306,15 @@ BOOL X11DRV_WineGL_InitOpenglInfo() TRACE("Client GLX version : %s.\n", WineGLInfo.glxClientVersion); TRACE("Direct rendering enabled: %s\n", WineGLInfo.glxDirect ? "True" : "False"); + /* restore old context and drawable */ + pglXMakeCurrent(gdi_display, oldwin, oldctx); + + ret = TRUE; +unable_to_init_ogl: wine_tsx11_unlock(); if(vis) XFree(vis); if(ctx) pglXDestroyContext(gdi_display, ctx); - return TRUE; + return ret; } static BOOL has_opengl(void) @@ -329,6 +343,7 @@ LOAD_FUNCPTR(glXChooseVisual) LOAD_FUNCPTR(glXCreateContext) LOAD_FUNCPTR(glXCreateGLXPixmap) LOAD_FUNCPTR(glXGetCurrentContext) +LOAD_FUNCPTR(glXGetCurrentDrawable) LOAD_FUNCPTR(glXDestroyContext) LOAD_FUNCPTR(glXDestroyGLXPixmap) LOAD_FUNCPTR(glXGetConfig)