nanogui
nanogui copied to clipboard
Can Nanogui run without X11 (or Wayland)?
Hi! Yes so I'm looking for a gui solution that has GL surfaces and can run on Linux without X11. So was wondering if nanogui can do that?
Cheers
AFAIK, no, not at this time. At least not out-of-the-box. NanoGUI relies on GLFW for window creation, input events and getting an OpenGL context to render the GUI to. GLFW in turn requires X11 or Wayland to do this.
You could compile GLFW with OSMESA (Off-screen mesa) support, but then you loose hardware acceleration. There is also a pull-request for GLFW that makes it work with raw OpenGL (and hence does not need X11/Wayland), but this pull-request has been open for a couple of years now and is not yet merged.
Yes I saw those PR's and that they've been there for a very long time. Wonder why it seems a great feature for glfw to have? I'm right now doing this using the 'nanogui-sdl' project as SDL2 allows for DRM render and I have that working now. I was hoping this project might do it as it seems a bit more up-to-date and active. Anyways what I'm doing right now will probably work for me. Thanks for replying!
Do you keep the GPU acceleration when using SDL2? That's my main goal here.
I've been experimenting with NanoGUI/GLFW on an arm64/Wayland/GLES2 platform, but I'm having a hard time getting it to work. I think Wayland/GLES support in GLFW is pretty spotty at this point. When I use the Wayland kiosk-shell even the basic GLES example in GLFW doesn't work (fails with some error message about the framebuffer being larger than the screen resolution).
So if NanoGUI with SDL2 works well I might give that a shot.
I think I have GPU accelleration I haven't run any heavy stuff in the program but it reports opengl as renderer. I thought/hoped it would pick gles2 as I'm on a Raspberry Pi4b and that seems a good option but I probably just don't know how to config SDL up to do it. It reports gles2 as being available.
You can see a bit more in a thread I have here and theres a scrappy example bit of code linked in the top post,
https://github.com/libsdl-org/SDL/issues/4808
Oh and this is the sdl specific project I'm using. Might not be very up to date compared with the latest nanogui.
https://github.com/dalerank/nanogui-sdl
Do you keep the GPU acceleration when using SDL2? That's my main goal here.
I've been experimenting with NanoGUI/GLFW on an arm64/Wayland/GLES2 platform, but I'm having a hard time getting it to work. I think Wayland/GLES support in GLFW is pretty spotty at this point. When I use the Wayland kiosk-shell even the basic GLES example in GLFW doesn't work (fails with some error message about the framebuffer being larger than the screen resolution).
So if NanoGUI with SDL2 works well I might give that a shot.
Yes, Wayland/GLES under arm64 isn't full. It isn't full OpenGL either. You can see this question I had for Toradex about Nuklear a few days ago. https://community.toradex.com/t/imx8-xopendisplay-null-weston-vivante/15480
I'm currently trying to deploy NanoGUI to a Toradex arm64 myself. Personally I'm hoping to use raw X11 without Wayland.
The NanoGUI-SDL port mentioned above by @Fredrum works directly with an OpenGL ES context (created through SDL2). I got the NanoGUI demo running that way on an Apalis iMX8 with TorizonCore installed (after some modifications), and it does run full-screen. This is without the Weston container running, since that prevents SDL2 from creating the OpenGL ES context.
Still not sure about the hardware acceleration though.
@jeroen94704 If you look in the test code here https://pastebin.com/s9GsXg8f there's commented out sections that will check what context and renderer your SDL2 session is using. Would that be enough to tell you if your sessions are HW accellerated? Maybe there's some OpenGL (ES) code you could add that would provide more?
Could I ask you if you are using 'nanogui-sdl' or if you managed to get regular nanogui to use the SDL2 context?
I'm having a hard time with nanogui-sdl, figuring out how to do things without glitching and there seems to be a bunch of bugs that I'm spending a lot of time figuring out how to work around. I'm thinking it might be easier if I could get regular Nanogui to run with SDL2.