Commit 87b7e4d1 authored by hybrid's avatar hybrid

Fix for render context change where only the window id is given. We now try to...

Fix for render context change where only the window id is given. We now try to change only the window ID, keeping context and display unchanged. Suggestion by vovo4ka from the forum.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4094 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 0368cfdd
...@@ -517,7 +517,9 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, ...@@ -517,7 +517,9 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
bool COpenGLDriver::changeRenderContext(const SExposedVideoData& videoData, CIrrDeviceLinux* device) bool COpenGLDriver::changeRenderContext(const SExposedVideoData& videoData, CIrrDeviceLinux* device)
{ {
if (videoData.OpenGLLinux.X11Display && videoData.OpenGLLinux.X11Window && videoData.OpenGLLinux.X11Context) if (videoData.OpenGLLinux.X11Window)
{
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.X11Window, (GLXContext)videoData.OpenGLLinux.X11Context))
{ {
...@@ -530,6 +532,21 @@ bool COpenGLDriver::changeRenderContext(const SExposedVideoData& videoData, CIrr ...@@ -530,6 +532,21 @@ bool COpenGLDriver::changeRenderContext(const SExposedVideoData& videoData, CIrr
X11Display = (Display*)videoData.OpenGLLinux.X11Display; X11Display = (Display*)videoData.OpenGLLinux.X11Display;
} }
} }
else
{
// in case we only got a window ID, try with the existing values for display and context
if (!glXMakeCurrent((Display*)ExposedData.OpenGLLinux.X11Display, videoData.OpenGLLinux.X11Window, (GLXContext)ExposedData.OpenGLLinux.X11Context))
{
os::Printer::log("Render Context switch failed.");
return false;
}
else
{
Drawable = videoData.OpenGLLinux.X11Window;
X11Display = (Display*)ExposedData.OpenGLLinux.X11Display;
}
}
}
// set back to main context // set back to main context
else if (X11Display != ExposedData.OpenGLLinux.X11Display) else if (X11Display != ExposedData.OpenGLLinux.X11Display)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment