Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
CGLXManager: Use GLX window correctly
Browse files Browse the repository at this point in the history
fixes #17
  • Loading branch information
sfan5 committed Mar 12, 2021
1 parent 0335a52 commit 57ff34b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions source/Irrlicht/CGLXManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ bool CGLXManager::generateSurface()

CurrentContext.OpenGLLinux.GLXWindow=GlxWin;
}
else
{
CurrentContext.OpenGLLinux.GLXWindow=CurrentContext.OpenGLLinux.X11Window;
}
return true;
}

Expand Down Expand Up @@ -353,27 +357,29 @@ 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;
}
}
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;
}
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 57ff34b

Please sign in to comment.