Render qml into canvas3d?



  • Hi all,

    I am fascinated from the new qml canvas3d element :)
    I would like to know if I could put qml elements into the canvas3d.
    My app contains a 3d object rendered with WebGL and I try to add fly outs to the 3d object.
    The Fly outs shall be made with qml. First I wanted to create images out of the qml element and use them as textures on a simple 3d plain. But this solution wont work because I want them interactive (e.g. click-able ).
    Or is there another way to put my 2d qml elements into a 3d space... attached to a 3d object?

    Thanks in advance :)



  • Hello and welcome to devnet,

    bq. The Fly outs shall be made with qml. First I wanted to create images out of the qml element and use them as textures on a simple 3d plain. But this solution wont work because I want them interactive (e.g. click-able ).

    You can make it clickable;

    @Image {
    ...
    MouseArea {
    anchors.fill: parent
    onClicked: console.log("Clicked the Image =)")
    }
    }@

    In this example the MouseArea will overlay the Image and will react on everything you want the MouseArea to react to.



  • Hey :) Thx for the welcome.

    Wouldn't I loose the MouseArea after putting the image into the canvas3d?



  • [quote author="Tasslord" date="1422281719"]Hey :) Thx for the welcome.

    Wouldn't I loose the MouseArea after putting the image into the canvas3d?
    [/quote]

    You're welcome. I haven't tried it, sorry. It was just an idea :). I would appreciate if you could try it out. If it won't work i'll seach for another approach.



  • QtQuick elements as texture will not be supported in Canvas3D 1.0. But it seems to be popping up quite often as a request so I'm considering supporting rendering of QtQuick elements to texture in later versions. Unfortunately it is rather involved rewrite of the Canvas3D rendering meaning serialization of all context calls, passing them to render thread etc. So probably it will take some time to implement it.

    You could try to mix the 2D QtQuick elements in to the scene by placing them on top of the Canvas3D element and using the "2.5D" transforms offered by QtQuick to make them appear more 3D.



  • What about setting layer.enabled on the element to turn it into a QSGTextureProvider and supporting QSGTexture in Canvas3D? All the QSG stuff lives on the render thread - is the issue that Canvas3D does not live on the render thread and so to use QSG it would need to serialize everything onto that thread?

    I'm hoping to eventually be able to use a VideoOutput with layer.enabled as a streaming video texture provider into Canvas3D.


Log in to reply
 

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