From 57ff34b1edb3e477b811ddf1165aa360a2e3eda6 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 12 Mar 2021 17:47:00 +0100 Subject: [PATCH] CGLXManager: Use GLX window correctly fixes #17 --- source/Irrlicht/CGLXManager.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/Irrlicht/CGLXManager.cpp b/source/Irrlicht/CGLXManager.cpp index 4778a498..b98e0b0f 100644 --- a/source/Irrlicht/CGLXManager.cpp +++ b/source/Irrlicht/CGLXManager.cpp @@ -296,6 +296,10 @@ bool CGLXManager::generateSurface() CurrentContext.OpenGLLinux.GLXWindow=GlxWin; } + else + { + CurrentContext.OpenGLLinux.GLXWindow=CurrentContext.OpenGLLinux.X11Window; + } return true; } @@ -353,13 +357,14 @@ bool CGLXManager::activateContext(const SExposedVideoData& videoData, bool resto { if (videoData.OpenGLLinux.X11Display && videoData.OpenGLLinux.X11Context) { - if (!glXMakeCurrent((Display*)videoData.OpenGLLinux.X11Display, videoData.OpenGLLinux.X11Window, (GLXContext)videoData.OpenGLLinux.X11Context)) + if (!glXMakeCurrent((Display*)videoData.OpenGLLinux.X11Display, videoData.OpenGLLinux.GLXWindow, (GLXContext)videoData.OpenGLLinux.X11Context)) { os::Printer::log("Context activation failed."); return false; } else { + CurrentContext.OpenGLLinux.GLXWindow = videoData.OpenGLLinux.GLXWindow; CurrentContext.OpenGLLinux.X11Window = videoData.OpenGLLinux.X11Window; CurrentContext.OpenGLLinux.X11Display = videoData.OpenGLLinux.X11Display; } @@ -367,13 +372,14 @@ bool CGLXManager::activateContext(const SExposedVideoData& videoData, bool resto else { // in case we only got a window ID, try with the existing values for display and context - if (!glXMakeCurrent((Display*)PrimaryContext.OpenGLLinux.X11Display, videoData.OpenGLLinux.X11Window, (GLXContext)PrimaryContext.OpenGLLinux.X11Context)) + if (!glXMakeCurrent((Display*)PrimaryContext.OpenGLLinux.X11Display, videoData.OpenGLLinux.GLXWindow, (GLXContext)PrimaryContext.OpenGLLinux.X11Context)) { os::Printer::log("Context activation failed."); return false; } else { + CurrentContext.OpenGLLinux.GLXWindow = videoData.OpenGLLinux.GLXWindow; CurrentContext.OpenGLLinux.X11Window = videoData.OpenGLLinux.X11Window; CurrentContext.OpenGLLinux.X11Display = PrimaryContext.OpenGLLinux.X11Display; } @@ -425,7 +431,7 @@ void CGLXManager::destroyContext() bool CGLXManager::swapBuffers() { - glXSwapBuffers((Display*)CurrentContext.OpenGLLinux.X11Display, CurrentContext.OpenGLLinux.X11Window); + glXSwapBuffers((Display*)CurrentContext.OpenGLLinux.X11Display, CurrentContext.OpenGLLinux.GLXWindow); return true; }