QQuickFramebufferObject with external OpenGL in Qt6
-
Hi Friends,
It looks like QQuickFramebufferObject is broken in Qt6. I have followed the changes required in documentation with no success. I have a working OCCT OpenGL viewer as a Quick Item in Qt 5.15.2 based on QQuickFramebufferObject. To port it to Qt6 I have tried:QCoreApplication::setAttribute (Qt::AA_UseDesktopOpenGL); QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL); QQuickWindow::setSceneGraphBackend("opengl");
I have removed window()->setClearBeforeRendering(false); from the Item as this method was removed in Qt6.
I have removed window()->resetOpenGLState(); from the render as this method was removed in Qt6.
All methods of the Renderer are correctly called, but nothing is rendered on the Qml Scene.
Any help will be appreciated.
-
Hi and welcome to devnet,
Which release are you testing your port with ?
On which OS ?Can you provide a minimal compilable example that shows your issue ?
-
Hi and welcome to devnet,
Which release are you testing your port with ?
On which OS ?Can you provide a minimal compilable example that shows your issue ?
Hi @SGaist ,
Thank you. My current unreleased app uses Qt5.15.2, on Linux 64bits. I am trying to port it to Qt6 in advance, so i will not start with an already legacy Qt version. The current app uses QQuickFramebufferObject to embed an OpenCascade View in Qml, it works well with Qt5.15.2 but I failed to port it to Qt6. As a workaround I ditched the QQuickFramebufferObject and now i am using the classical beforeRendering/beforeRenderPassRecording on a QQuickItem derived class and it works. -
Hi this might be due to the new Qt RHI, an abstraction over OpenGL, Vulkan, Metal, DirectX (might have forgotten some or mentioned some that shouldn't be).
Qt Quick will no longer be speaking directly to OpenGL but there will be an abstraction on top of it to ensure compatility with other graphical stacks.
You will get more info about this by googling around or watching this webinar : https://www.youtube.com/watch?v=eInD6H4XrpM
-
Hi this might be due to the new Qt RHI, an abstraction over OpenGL, Vulkan, Metal, DirectX (might have forgotten some or mentioned some that shouldn't be).
Qt Quick will no longer be speaking directly to OpenGL but there will be an abstraction on top of it to ensure compatility with other graphical stacks.
You will get more info about this by googling around or watching this webinar : https://www.youtube.com/watch?v=eInD6H4XrpM
@GrecKo , @SGaist , @mnesarco - Has the OP's issue with QQuickFrameBufferObject (nothing rendered) been resolved in Qt 6? I've migrated to 6.7.2 and my QQuickFrameBufferObject-based application now segfaults somewhere in the Qt libraries. I realize that QQuickFrameBufferObject is now considered a 'legacy' class and works only with OpenGL, but if possible I'd like to track down the segfault and move on, deferring use of RHI to another day.
Thanks! -
Hi @SGaist ,
Thank you. My current unreleased app uses Qt5.15.2, on Linux 64bits. I am trying to port it to Qt6 in advance, so i will not start with an already legacy Qt version. The current app uses QQuickFramebufferObject to embed an OpenCascade View in Qml, it works well with Qt5.15.2 but I failed to port it to Qt6. As a workaround I ditched the QQuickFramebufferObject and now i am using the classical beforeRendering/beforeRenderPassRecording on a QQuickItem derived class and it works. -
I'm currently working on getting on of my older applications to work with PyQt6 on Wayland. The python-mpv library has classically used an X window ID for telling mpv where to render, but that obviously won't work on Wayland. There are several examples of using OpenGL rendering with python-mpv:
https://github.com/trin94/qtquick-mpv
The PySide6 example does work, but my entire application is written in PyQt6: https://gitlab.com/djsumdog/mediahug/
I've been playing around with the code trying to figure out what's happening. All the mpv output looks identical between the different API examples. Creating another window and commenting out the setSource/show for the quickview prevents it from crashing out. I guess there might be an issue with the PyQt6 bindings? I'd really rather not trade out everything in my code for PySide.