eGL or GLX for Debian package ?

Problems building or running the engine, queries about how to use features etc.
flavio
Gnoblar
Posts: 16
Joined: Tue Sep 01, 2015 4:41 pm

eGL or GLX for Debian package ?

Post by flavio »

Ogre Version: 14.4.1
Operating System: Debian testing
Render System: GL3Plus

Hello guys,

I am working on the upgrade of the Debian package of Ogre [1][2], introducing a package ogre-14.
I am close to have something functional but while testing the package with my software Sight[3] in a virtual machine (VMWare), my apps refuse to launch because of EGL support :

Code: Select all

[2163][00:00:01.223126][info] [module/viz/scene3d/plugin.cpp:117] RenderSystem::_createRenderWindow "Dummy", 1x1 windowed  miscParams: currentGLContext=true hidden=true 
[2164][00:00:01.223390][error] [lib/__/service/detail/service.cpp:276] Error while STARTING service 'tuto07_generic_scene-1-generic_scene_srv' : RenderingAPIException: currentGLContext was specified with no current GL context in EGLWindow::create at ./RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLWindow.cpp (line 258)
[2165][00:00:01.223412][error] [lib/__/service/detail/service.cpp:277] service 'tuto07_generic_scene-1-generic_scene_srv' is still STOPPED.
sightrun.bin: ./OgreMain/src/OgreTextureManager.cpp:40: static Ogre::TextureManager& Ogre::TextureManager::getSingleton(): Assertion `msSingleton' failed.

I am a bit lost at this point. In the previous version, we had no choice but to use GLX. I understand that EGL is now the default to get Wayland support. But I tested with MATE, which does not use Wayland, so I guess that's my issue: the build is not compatible with X11. I have the same issue on my laptop running Ubuntu 24.04 Cinnamon with a locally compiled version of Ogre 14.1.

Of course, I understand I can solve this, for my case, by setting OGRE_GLSUPPORT_USE_EGL to OFF. But for a system-wide package on Debian, what should I use? Ideally, I would like something that works whatever the desktop used. Is that even possible?

Thanks for your help.

[1] https://salsa.debian.org/games-team/ogre
[2] https://lists.debian.org/debian-devel-g ... 00013.html
[3] https://git.ircad.fr/sight/sight

paroj
OGRE Team Member
OGRE Team Member
Posts: 2237
Joined: Sun Mar 30, 2014 2:51 pm
x 1216

Re: eGL or GLX for Debian package ?

Post by paroj »

OGRE_GLSUPPORT_USE_EGL will use EGL with X11
OGRE_USE_WAYLAND on top will use EGL with Wayland.

Unfortunately the wayland flag is currently compile time, so you cannot support both Wayland and X11 with the same build.
X11 can run via XWayland on Wayland, but there is no way to do it the other way round I would stick with X11 for now (until Debian goes with Wayland by default).

Your issue is that you set currentGLContext and then provide a GLX context (via Qt) to the EGL backend. If you make Qt use EGL all should work.

From a compatibility perspective there is no loss sticking with GLX for X11. However looking forward it would make sense to use EGL as you will need it for Wayland eventually. Then people can start fixing stuff like your currentGLContext issue now and porting to Wayland will be less work.

flavio
Gnoblar
Posts: 16
Joined: Tue Sep 01, 2015 4:41 pm

Re: eGL or GLX for Debian package ?

Post by flavio »

Thanks for your answer.

If I understand, the question of Wayland vs X11 is not really my concern. I should be able to use EGL with X11, provided that Qt creates the context properly?

I tried to launch my app with QT_XCB_GL_INTEGRATION=xcb_egl, and indeed, I went a bit further. But I am still stuck in X11EGLWindow::create(), at line 356 instead of 258. The context can be grabbed, but when calling createEGLContext() (thus with an external context), the program fails in eglMakeCurrent(). That's when I use my Intel Arc.
If I use the discrete GPU (NVidia RTX3000), it's even worse, I got a crash just the line above when creating the surface:

Code: Select all

[2176][00:00:30.678741][error] [lib/__/service/detail/service.cpp:276] Error while STARTING service 'tuto07_generic_scene-1-generic_scene_srv' : RenderingAPIException: Fail to create EGLSurface based on NativeWindowType in createSurfaceFromWindow at /home/fbridault/dev/3rdParty/OGRECave/RenderSystems/GLSupport/src/EGL/OgreEGLWindow.cpp (line 228)

Did I miss something to make the context initialised properly by Qt?

paroj
OGRE Team Member
OGRE Team Member
Posts: 2237
Joined: Sun Mar 30, 2014 2:51 pm
x 1216

Re: eGL or GLX for Debian package ?

Post by paroj »

this might be a bug in Ogre. Try adding this to X11EGLWindow: https://github.com/OGRECave/ogre/pull/3236/files

flavio
Gnoblar
Posts: 16
Joined: Tue Sep 01, 2015 4:41 pm

Re: eGL or GLX for Debian package ?

Post by flavio »

This is weird, mEglSurface is still null after calling eglGetCurrentSurface(EGL_DRAW); mEglDisplay is well set.

It seems correctly initialized according to the log:

Code: Select all

qt.core.plugin.factoryloader: Got keys from plugin meta data QList("xcb_glx")
qt.core.plugin.factoryloader: checking directory path "/home/fbridault/dev/sight/build/Debug/sight/bin/xcbglintegrations" ...
qt.core.library: "/usr/lib/x86_64-linux-gnu/qt6/plugins/xcbglintegrations/libqxcb-egl-integration.so" loaded library
qt.qpa.gl: Xcb EGL gl-integration created
qt.qpa.gl: Xcb EGL gl-integration successfully initialized

I am trying to figure out if it is supposed to be created in https://github.com/qt/qtbase/blob/dev/s ... ration.cpp and https://github.com/qt/qtbase/blob/dev/s ... window.cpp.

But I am no so sure a surface is created during the init. I won't have much time today to investigate, I will try later.

Thanks again ! :)

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 250
Joined: Fri May 23, 2025 5:04 pm
x 16

Re: eGL or GLX for Debian package ?

Post by slapin »

xcb_glx is X11 display with glX, so should be no problem with X11+GLX
I also have X11+EGL running on aarch64 build, as well as X11+GLX. Also X11+GLX+Qt build of Ogitor works fine (at least for what is there),
so Ogre should be fine with Qt on X11.

paroj
OGRE Team Member
OGRE Team Member
Posts: 2237
Joined: Sun Mar 30, 2014 2:51 pm
x 1216

Re: eGL or GLX for Debian package ?

Post by paroj »

flavio wrote: Mon Nov 03, 2025 10:00 am

But I am no so sure a surface is created during the init. I won't have much time today to investigate, I will try later.

you can also start packaging with GLX. I think the version bump alone is more then worth it.

btw. there was an effort to update the package a bit here:
https://salsa.debian.org/games-team/ogr ... requests/6

notably it splits off ogrebites (SDL dep) and ogrebitesqt (Qt dep).

Btw you could try ogrebitesqt for ogre integration. It should work regardless of EGL/ GLX.