View Full Version : Render a QML scene into a texture and save it
stereoMatching
13th June 2013, 04:57
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
stereoMatching
13th June 2013, 13:02
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) //this function will transfer the root item to texture and save it into QImage
}
}
}
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.
stereoMatching
13th June 2013, 17:09
I found a way to do it
http://www.qtcentre.org/threads/54964-How-to-take-ScreenShot-Qt-QML
We could take the screenshot, then render the QImage to texture
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.