From f829d8047a7cddb18695b1209ff34690198fb701 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Tue, 23 Apr 2024 13:55:26 +0200 Subject: [PATCH] Ogre2RenderEngine: on Windows if useCurrentGLContext is specified, set the externalWindowsHandle ogre-next option Signed-off-by: Silvio Traversaro --- ogre2/src/Ogre2RenderEngine.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ogre2/src/Ogre2RenderEngine.cc b/ogre2/src/Ogre2RenderEngine.cc index c83edd987..93ee74c41 100644 --- a/ogre2/src/Ogre2RenderEngine.cc +++ b/ogre2/src/Ogre2RenderEngine.cc @@ -1263,6 +1263,22 @@ std::string Ogre2RenderEngine::CreateRenderWindow(const std::string &_handle, { params["externalGLControl"] = "true"; params["currentGLContext"] = "true"; + +#if defined(_MSC_VER) + if (!this->winID.empty()) + { + params["externalWindowHandle"] = this->winID; + } + else + { + gzerr << "useCurrentGLContext option specified, " + << "but no winID specified." << std::endl + << "On Windows if useCurrentGLContext is specified, " + << "the ogre2 rendering requires that also winID is specified." + << std::endl; + return std::string(); + } +#endif } #if !defined(__APPLE__) && !defined(_MSC_VER)