On 9. juli 2013, at 09:11, "Dr. André Bergner" <[email protected]<mailto:[email protected]>> wrote:
Hi Qt-devs, I have problems applying a ShaderEffect to a custom QQuickItem drawing raw OpenGL directives. I have a little QML script as test case, which I copied from here: http://qt-project.org/doc/qt-5.0/qtgraphicaleffects/qml-qtgraphicaleffects1-gaussianblur.html I replaced the image of that example with my custom QQuickItem drawing raw OpenGL. This custom item I created following this example: http://doc-snapshot.qt-project.org/qt5-stable/qtquick/scenegraph-textureinsgnode-fboinsgrenderer-cpp.html I.e., I subclassed QQuickItem. Within updatePaintNode I generate a new QSGSimpleTextureNode having a FBO as texture. On the QQuickWindow::beforeRendering signal I draw my OpenGL stuff into that FBO. My custom OpenGLItem has some property exposed to QML and is animated using a Timer within the QML script. Now, my problem is that while the Blur is inactive my custom OpenGL code is nicely drawn into the item and animated properly. When I switch on the shader the shader is computed only once and stays then static. The animation -- even though still rendered into the FBO -- is not picked up by the ShaderEffect item. The only way to trigger an update of the shader. This will generate a new QSGSimpleTextureNode with a fresh FBO. When I test the Blur with a small animated Rectangle put inside another Rectangle this animation is visible within the blur. What do I need to add to my custom QQuickItem in order to signal changes and trigger redraws of dependent items such as that blur? I could not find any apportierte signal. What else do I miss? Try calling QSGNode::markDirty(QSGNode::DirtyMaterial) on the node after changing the FBO. The example should strictly speaking also be doing this... However, if you intend to use the texture as input to a ShaderEffect, you might want to consider implenementing the QQuickItem::textureProvider() function to save the extra FBO. Cheers, Gunnar Thanks a lot in advance, André _______________________________________________ Development mailing list [email protected]<mailto:[email protected]> http://lists.qt-project.org/mailman/listinfo/development
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
