Recent

Author Topic: [Solved] OpenGLContext with Qt5 on Wayland  (Read 3979 times)

aydın

  • Jr. Member
  • **
  • Posts: 86
[Solved] OpenGLContext with Qt5 on Wayland
« on: July 17, 2025, 09:21:27 pm »
Hello everyone,

I’ve been developing my applications using the Qt5 widgetset in Lazarus, and everything was going fine—until I tried to use OpenGL.

I found this note:

Code: Text  [Select][+][-]
  1. It works under the following platforms:
  2.   - gtk with glx  : full
  3.   - gtk2 with glx : full
  4.   - qt with glx   : no (started)


I’m wondering: Will the Qt support for OpenGL ever be completed?
It feels like it’s been a very long time, and it might have been forgotten.

Is there any workaround to get OpenGL working under the Qt widgetset?

Thanks in advance.
« Last Edit: July 19, 2025, 03:30:49 pm by aydın »
Lazarus 4.99, FPC 3.3.1 on Fedora 42

zamtmn

  • Hero Member
  • *****
  • Posts: 674
Re: QT5 OpenGLContext
« Reply #1 on: July 18, 2025, 10:14:50 pm »
LazOpenGLControl works in qt5 with glx. There are problems there, but in general it works

aydın

  • Jr. Member
  • **
  • Posts: 86
Re: QT5 OpenGLContext
« Reply #2 on: July 18, 2025, 10:59:45 pm »
I’m using Lazarus 4.0 with FPC 3.2.2 on Fedora 42, with the Qt5 widgetset.

This should be a fairly up-to-date setup.

However, when I add a TOpenGLControl to a form, the application shows an error message on startup and crashes with a SIGSEGV.

It works perfectly fine when using the Gtk2 widgetset.

Is there anything extra I need to do to make it work with Qt5?
Lazarus 4.99, FPC 3.3.1 on Fedora 42

zamtmn

  • Hero Member
  • *****
  • Posts: 674
Re: QT5 OpenGLContext
« Reply #3 on: July 19, 2025, 09:20:34 am »
Wayland or X11 session?
I test with Neon+X11=works

cdbc

  • Hero Member
  • *****
  • Posts: 2464
    • http://www.cdbc.dk
Re: QT5 OpenGLContext
« Reply #4 on: July 19, 2025, 09:34:54 am »
Hi
He's running Fedora, that's Wayland, as Fedora is on the upstream of Linux-distro development...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6 -> FPC 3.2.2 -> Lazarus 4.0 up until Jan 2025 from then on it's both above &: KDE6/QT6 -> FPC 3.3.1 -> Lazarus 4.99

aydın

  • Jr. Member
  • **
  • Posts: 86
Re: QT5 OpenGLContext
« Reply #5 on: July 19, 2025, 01:26:25 pm »
Yes, I should have mentioned that as well.
I’m using Wayland.
Lazarus 4.99, FPC 3.3.1 on Fedora 42

Alexx2000

  • New Member
  • *
  • Posts: 20
Re: QT5 OpenGLContext
« Reply #6 on: July 19, 2025, 01:49:09 pm »
Looks like LazOpenGLControl does not support Wayland (it depends on X11 libraries). Gtk works because it using Xwayland. I guess Qt version will work if you start it under Xwayland, something like:
Code: [Select]
./project1 -platform xcb
« Last Edit: July 19, 2025, 01:53:10 pm by Alexx2000 »

aydın

  • Jr. Member
  • **
  • Posts: 86
Re: QT5 OpenGLContext
« Reply #7 on: July 19, 2025, 03:27:14 pm »
Thanks everyone.

Yes, forcing XWayland worked!

I think X11 will continue to be supported for quite a while.

But maybe Wayland support could at least be considered in the roadmap.
It seems like Wayland will eventually replace X11 in the long run.
« Last Edit: July 19, 2025, 03:30:14 pm by aydın »
Lazarus 4.99, FPC 3.3.1 on Fedora 42

Seenkao

  • Hero Member
  • *****
  • Posts: 717
    • New ZenGL.
Re: [Solved] OpenGLContext with Qt5 on Wayland
« Reply #8 on: July 20, 2025, 05:21:23 pm »
It seems like Wayland will eventually replace X11 in the long run.
Wayland ни когда не заменит X11. У них совершенно разная функциональность.
Как что-то параллельное - это можно рассматривать. Как полноценную замену - нет. В Wayland не будет той функциональности, что есть в X11 (по большей части она конечно не нужна большинству) и определённая функциональность нужна, но её не предоставляют разработчики Wayland (хотя этим разработчикам сообщают о проблемах уже много лет).

----------------------------------------------------------------
Google translate:
Wayland will never replace X11. They have completely different functionality.
As something parallel - it can be considered. As a full-fledged replacement - no. Wayland will not have the functionality that X11 has (most of it is certainly not needed by most) and certain functionality is needed, but it is not provided by the Wayland developers (although these developers have been informed about problems for many years).

XLibre on the forum.
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

aydın

  • Jr. Member
  • **
  • Posts: 86
Re: [Solved] OpenGLContext with Qt5 on Wayland
« Reply #9 on: July 21, 2025, 08:36:56 am »
Honestly, as an end user, the differences between X11 and Wayland don’t really matter much to me.
In fact, I’d even say Wayland’s more restrictive nature gives me a sense of security.
The same goes for many WinAPIs — they feel too exposed. As a user, I actually want some level of protection and security constraints.

Right now, it’s clear that most major Linux distributions are already shifting toward Wayland as the default.
And unless legacy X11 applications adapt by supporting newer APIs, they’ll inevitably require some compatibility layer like XWayland.

Of course, Wayland won’t replace X11 entirely or instantly — maybe not even ever.
But for most popular desktop environments today, it’s already becoming the first choice.
Lazarus 4.99, FPC 3.3.1 on Fedora 42

 

TinyPortal © 2005-2018