[Interest] Porting Qt5 OpenGL app to Qt6 - QQuickRenderTarget and OpenGL frame buffer object
Nuno Santos
nuno.santos at imaginando.pt
Tue Apr 16 16:21:25 CEST 2024
Hi,
I have an application that was heavily written on top of OpenGL. Right now I want to port it to Qt 6 with the minimum effort trying to stick to the OpenGL backend until I get the grip on the new things of Qt 6 Graphics API abstraction.
I used to do this in order to assign a target FBO to a QuickWindow:
_quickWindow->setRenderTarget(_fboRender);
This is no longer possible and it requires a QQuickRenderTarget to be created and I seem to have three options:
(since 6.2) QQuickRenderTarget fromOpenGLRenderBuffer(uint renderbufferId, const QSize &pixelSize, int sampleCount = 1)
(since 6.4) QQuickRenderTarget fromOpenGLTexture(uint textureId, uint format, const QSize &pixelSize, int sampleCount = 1)
QQuickRenderTarget fromOpenGLTexture(uint textureId, const QSize &pixelSize, int sampleCount = 1)
I’m trying this:
_renderTarget = QQuickRenderTarget::fromOpenGLRenderBuffer(0, QSize(_renderResolution.width(), _renderResolution.height()));
_quickWindow->setRenderTarget(_renderTarget);
But nothing appears on the screen and I get a warning:
QQuickWindow: No render target (neither swapchain nor custom target was provided)
Can anyone tell me what am I failing here?
Any ideas suggestions are very welcome.
With my best regards,
Nuno
More information about the Interest
mailing list