From b8089b6e276b7c298d17a4360dea6a49cabf7a21 Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Tue, 7 Feb 2023 18:44:07 +0100 Subject: [PATCH] GLSupport: EGL - fix multi-window operation --- RenderSystems/GLSupport/src/EGL/OgreEGLContext.cpp | 3 +++ RenderSystems/GLSupport/src/EGL/OgreEGLWindow.cpp | 2 +- RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLWindow.cpp | 9 +-------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/RenderSystems/GLSupport/src/EGL/OgreEGLContext.cpp b/RenderSystems/GLSupport/src/EGL/OgreEGLContext.cpp index 35ee41f51b5..9277d4eb125 100644 --- a/RenderSystems/GLSupport/src/EGL/OgreEGLContext.cpp +++ b/RenderSystems/GLSupport/src/EGL/OgreEGLContext.cpp @@ -129,6 +129,9 @@ namespace Ogre { void EGLContext::setCurrent() { + if(eglGetCurrentSurface(EGL_DRAW) == mDrawable) + return; + EGLBoolean ret = eglMakeCurrent(mEglDisplay, mDrawable, mDrawable, mContext); EGL_CHECK_ERROR diff --git a/RenderSystems/GLSupport/src/EGL/OgreEGLWindow.cpp b/RenderSystems/GLSupport/src/EGL/OgreEGLWindow.cpp index 6d11662eb88..0c5d9323e51 100644 --- a/RenderSystems/GLSupport/src/EGL/OgreEGLWindow.cpp +++ b/RenderSystems/GLSupport/src/EGL/OgreEGLWindow.cpp @@ -119,7 +119,7 @@ namespace Ogre { { return; } - + mContext->setCurrent(); if (eglSwapBuffers(mEglDisplay, mEglSurface) == EGL_FALSE) { EGL_CHECK_ERROR diff --git a/RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLWindow.cpp b/RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLWindow.cpp index 424bee909da..54b8ab168b2 100644 --- a/RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLWindow.cpp +++ b/RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLWindow.cpp @@ -268,8 +268,6 @@ namespace Ogre { "EGLWindow::create"); } - mEglSurface = eglGetCurrentSurface(EGL_DRAW); - EGL_CHECK_ERROR mEglDisplay = eglGetCurrentDisplay(); EGL_CHECK_ERROR } @@ -339,8 +337,6 @@ namespace Ogre { } } - mIsExternal = (mEglSurface != 0); - if (!mEglConfig) { int minAttribs[] = { @@ -381,10 +377,7 @@ namespace Ogre { mGLSupport->switchMode (width, height, frequency); } - if (!mIsExternal) - { - createNativeWindow(left, top, width, height, title); - } + createNativeWindow(left, top, width, height, title); mContext = createEGLContext(eglContext);