How to grabs the contents of and item with QQuickRenderControl?



  • On QQuickRenderControl help, [http://doc.qt.io/qt-5/qquickrendercontrol.html#details](link url), says:

    "QQuickWindow and QQuickView and their associated internal render loops render the Qt Quick scene onto a native window. In some cases, for example when integrating with 3rd party OpenGL renderers, it might be beneficial to get the scene into a texture that can then be used in arbitrary ways by the external rendering engine. QQuickRenderControl makes this possible in a hardware accelerated manner, unlike the performance-wise limited alternative of using QQuickWindow::grabWindow()"

    How to use QQuickRenderControl to do the same functionallity than QQuickWindow::grabWindow()? And, is it possible to do it only with a QQuickItem?


  • Moderators

    Hi! There is an example on how to use QQuickRenderControl, see here.



  • Hi!

    I've already seen this example, but it's very complex and seems that it isn't like a grabWindow. It seems that is an example for draw in the scene, but, how can I grab the scene content in a QImage like grabWindow?


  • Moderators

    QQuickRenderControl makes it possible to render into a FBO, so the image stays in the GPU. You can then reuse the image in other GPU operations. That makes it fast. grabWindow copies the image from the GPU's RAM to the systems RAM, so you can process the image with the CPU. Uploading it to the GPU again for reuse would make it slow.

    In simple words: If you want to have a QImage, then use grabWindow. If you want to have the image inside a FBO, use QQuickRenderControl and friends.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.