Qt 6.11 is out! See what's new in the release
blog
After offscreen rendering the opengl texture is still empty
-
Hello,
I'm trying to render offscreen a qml file. But after the rendering the opengl texture remain empty.
The test application can be found here but the render part look like that:_qcontext->makeCurrent(_offscreenSurface); _fbo->bind(); _quickWindow->setRenderTarget(QQuickRenderTarget::fromOpenGLTexture(_fbo->texture(), GL_RGBA, QSize(_width, _height))); _renderControl->beginFrame(); _renderControl->polishItems(); _renderControl->sync(); _renderControl->render(); _renderControl->endFrame(); _fbo->toImage().save(QString("toImgage-%1.png").arg(_fbo->texture())); _qcontext->functions()->glBindTexture(GL_TEXTURE_2D, _fbo->texture()); QImage img(_width, _height, QImage::Format_RGBA8888); _qcontext->functions()->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, _width, _height, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, img.bits()); img.save(QString("img-%1.png").arg(_fbo->texture()));if the line 9th line ( _fbo->toImage() ) is commented out the texture remain empty. How can I force the result to be store in the texture without calling the toImage function ?
Regards,