<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[After offscreen rendering the opengl texture is still empty]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I'm trying to render offscreen a qml file. But after the rendering the opengl texture remain empty.<br />
The test application can be found <a href="https://github.com/knard/kstream" target="_blank" rel="noopener noreferrer nofollow ugc">here</a> but the render part look like that:</p>
<pre><code>_qcontext-&gt;makeCurrent(_offscreenSurface);
    _fbo-&gt;bind();
    _quickWindow-&gt;setRenderTarget(QQuickRenderTarget::fromOpenGLTexture(_fbo-&gt;texture(), GL_RGBA, QSize(_width, _height)));
    _renderControl-&gt;beginFrame();
    _renderControl-&gt;polishItems();
    _renderControl-&gt;sync();
    _renderControl-&gt;render();
    _renderControl-&gt;endFrame();
    _fbo-&gt;toImage().save(QString("toImgage-%1.png").arg(_fbo-&gt;texture()));
    _qcontext-&gt;functions()-&gt;glBindTexture(GL_TEXTURE_2D, _fbo-&gt;texture());
    QImage img(_width, _height, QImage::Format_RGBA8888);
    _qcontext-&gt;functions()-&gt;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-&gt;texture()));
</code></pre>
<p dir="auto">if the line 9th line ( _fbo-&gt;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 ?</p>
<p dir="auto">Regards,</p>
]]></description><link>https://forum.qt.io/topic/140502/after-offscreen-rendering-the-opengl-texture-is-still-empty</link><generator>RSS for Node</generator><lastBuildDate>Wed, 05 Aug 2026 15:46:41 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/140502.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 03 Nov 2022 20:22:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to After offscreen rendering the opengl texture is still empty on Sun, 13 Nov 2022 12:31:23 GMT]]></title><description><![CDATA[<p dir="auto">I solved my issue by setting the graphic device to a device created from the opengl context and by creating the FBO while the opengl is binded.</p>
]]></description><link>https://forum.qt.io/post/735936</link><guid isPermaLink="true">https://forum.qt.io/post/735936</guid><dc:creator><![CDATA[K nard]]></dc:creator><pubDate>Sun, 13 Nov 2022 12:31:23 GMT</pubDate></item></channel></rss>