Ogre Version: : 1 13 5 6:
Operating System: :Linux OpenSuse 15.5:
Render System: :OpenGL3+
Hello,
I try to hide the system cursor inside the game; to do that I use the sfml library because it has the method sfmlWindow.setMouseCursorVisible(false);
When I try to build the game OpendungeonsPlus with the support for SFML library ( that way many things are done with the help of it : for example The creation of window) I end up with the error :
An exception has occurred: RenderingAPIException: currentGLContext was specified with no current GL context in EGLWindow::create at /home/tom/Downloads/ogre-13.6.5/RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLWindow.cpp (line 268)Segmentation fault (core dumped)
Here's how I create the window :
Code: Select all
#ifdef OD_USE_SFML_WINDOW
// Check if the config specifies fullscreen or windowed
auto style = configManager.getVideoValue(Config::FULL_SCREEN, "No", false) == "Yes" && sf::VideoMode(w, h).isValid() ? sf::Style::Fullscreen : sf::Style::Default;
// Create an SFML window
// we make sure to grab the right bit depth from the current desktop mode as otherwise full screen
// can end up not working properly.
// TODO: Check anti-aliasing settings here.
sf::RenderWindow sfmlWindow(sf::VideoMode(w, h, sf::VideoMode::getDesktopMode().bitsPerPixel)
, windowTitle, style, sf::ContextSettings(32, 0, 2, 1));
sfmlWindow.setMouseCursorVisible(false);
ogreRoot.initialise(false);
Ogre::RenderWindow* renderWindow = [&](){
Ogre::NameValuePairList misc;
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
auto winHandle = reinterpret_cast<size_t>(sfmlWindow.getSystemHandle());
auto winGlContext = reinterpret_cast<size_t>(wglGetCurrentContext());
misc["externalWindowHandle"] = Helper::toString(winHandle);
misc["externalGLContext"] = Helper::toString(winGlContext);
misc["externalGLControl"] = Ogre::String("True");
#else
misc["currentGLContext"] = Ogre::String("true");
#endif
return ogreRoot.createRenderWindow(windowTitle, w, h, style == sf::Style::Fullscreen, &misc);
}();
renderWindow->setVisible(true);
#else /* OD_USE_SFML_WINDOW */
ogreRoot.initialise(false);
Ogre::NameValuePairList misc;
misc["FSAA"] = "0";
misc["vsync"] = "true";
// You can also later load these from config or allow command-line override
OD_LOG_INF("Creating window: with resolution " + Helper::toString(w) + " " + Helper::toString(h));
Ogre::RenderWindow* renderWindow = ogreRoot.createRenderWindow("OpenDungeons " + VERSION, w, h, configManager.getVideoValue(Config::FULL_SCREEN, "No", false) == "Yes" , &misc);
Ogre::WindowEventUtilities::_addRenderWindow(renderWindow);
#endif /* OD_USE_SFML_WINDOW */
and here's the stacktrace from gdb :
Code: Select all
#0 0x00007ffff4e66601 in __cxa_throw () from /usr/lib64/libstdc++.so.6
#1 0x00007ffff30964ba in Ogre::ExceptionFactory::_throwException (line=268, file=0x7ffff30adec8 "/home/tom/Downloads/ogre-13.6.5/RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLWindow.cpp",
src="EGLWindow::create", desc="currentGLContext was specified with no current GL context", number=3, code=Ogre::Exception::ERR_RENDERINGAPI_ERROR)
at /home/tom/Downloads/ogre-13.6.5/OgreMain/include/OgreException.h:264
#2 Ogre::ExceptionFactory::throwException (line=268, file=0x7ffff30adec8 "/home/tom/Downloads/ogre-13.6.5/RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLWindow.cpp",
src="EGLWindow::create", desc="currentGLContext was specified with no current GL context", code=Ogre::Exception::ERR_RENDERINGAPI_ERROR)
at /home/tom/Downloads/ogre-13.6.5/OgreMain/include/OgreException.h:280
#3 Ogre::X11EGLWindow::create (this=<optimized out>, name=..., width=<optimized out>, height=<optimized out>, fullScreen=<optimized out>, miscParams=0x7fffffffb190)
at /home/tom/Downloads/ogre-13.6.5/RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLWindow.cpp:266
#4 0x00007ffff30946af in Ogre::X11EGLSupport::newWindow (this=0xcc5af0, name="OpenDungeons 0.7.1", width=1920, height=1200, fullScreen=<optimized out>, miscParams=0x7fffffffb190)
at /home/tom/Downloads/ogre-13.6.5/RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLSupport.cpp:178
#5 0x00007ffff3087406 in Ogre::GL3PlusRenderSystem::_createRenderWindow (this=0xcc5400, name="OpenDungeons 0.7.1", width=1920, height=1200, fullScreen=false, miscParams=0x7fffffffb190)
at /home/tom/Downloads/ogre-13.6.5/RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp:550
#6 0x00007ffff644d46b in Ogre::Root::createRenderWindow (this=0x7fffffffcc80, name=..., width=<optimized out>, height=<optimized out>, fullScreen=<optimized out>,
miscParams=<optimized out>) at /home/tom/Downloads/ogre-13.6.5/OgreMain/src/OgreRoot.cpp:1067
#7 0x0000000000a9e284 in <lambda()>::operator()(void) const (__closure=0x7fffffffd280) at /home/tom/Opendungeons/OpenDungeonsPlus/source/ODApplication.cpp:189
#8 0x0000000000a9ea57 in ODApplication::startClient (this=0x7fffffffdc30) at /home/tom/Opendungeons/OpenDungeonsPlus/source/ODApplication.cpp:190
#9 0x0000000000a9dac4 in ODApplication::startGame (this=0x7fffffffdc30, options=...) at /home/tom/Opendungeons/OpenDungeonsPlus/source/ODApplication.cpp:81
#10 0x0000000000aa0f7c in main (argc=1, argv=0x7fffffffdec8) at /home/tom/Opendungeons/OpenDungeonsPlus/source/main.cpp:8
What shall I do to make the sfml version of the game work ? Or do you know some other , more general way of disabling mouse cursor inside the window ?
P.S. I use the X11 windowing system.