Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved]Render a QML scene into a texture and save it
Forum Updated to NodeBB v4.3 + New Features

[Solved]Render a QML scene into a texture and save it

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 1 Posters 3.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stereomatching
    wrote on last edited by
    #1

    How could I translate the QML scene(like Rectangle, Image etc) into a texture and save it?
    Anyone tried this before?If I can translate the components to texture, then I should be able to save
    the image after processing by particle systems or shaderEffects

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stereomatching
      wrote on last edited by
      #2

      Looks like shaderEffectSource could render the qml scene to texture, but it do not provide a way for us to access the texture or save it, do anyone know where are the plug in source codes of the shaderEffectSource?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stereomatching
        wrote on last edited by
        #3

        Example:

        @
        Rectangle{
        id:root

        widht:640
        height: 480

        ToTexture{ id: toTexture} //a new type created by c++

        MouseArea{

         anchors.fill: parent
        
         onClicked: {         
             toTexture.saveAsTexture(root)
         }
        

        }
        }
        @

        The problem is, how could I design a new type like "ToTexture"? The example of " Scene Graph - OpenGL Under QML." show us how to render a qml scene, but I can't find an example show us how to transfer the qml scene to a texture.

        Without this function, I can't save the graph generated QtQuick

        1 Reply Last reply
        0
        • S Offline
          S Offline
          stereomatching
          wrote on last edited by
          #4

          I found the other example

          "take screenshot":http://qt-project.org/forums/viewthread/28822/

          Take the screenshot by QQuickView, then do what we want

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved