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. 2D QML as texture of Quick3D Object
QtWS25 Last Chance

2D QML as texture of Quick3D Object

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 2 Posters 3.3k Views
  • 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.
  • P Offline
    P Offline
    paxl
    wrote on last edited by
    #1

    I've been searching around for a while now and can't seem to find anything about this. I'd like to use 2d qml inside qt3d objects. For exemple let's have a Cube, I would like to assign a qml listview for each of its faces.
    Can anyone tell me if it's possible.

    Thanks

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AleksandarJovanov
      wrote on last edited by
      #2

      QML is rendered onto a QDeclarativeView which inherits from QWidget.
      That means that it has the QWidget::winId function.
      That function is used in QPixmap.grabWindow.
      http://qt-project.org/doc/qt-4.8/qpixmap.html#grabWindow
      I have not used qt3d,so I do not know how to map the generated texture.
      Source: http://www.qtcentre.org/threads/12882-Save-content-of-widget-to-pixmap
      EDIT:
      I found this http://doc.qt.nokia.com/qt-quick3d-snapshot/qgltexture2d.html#setPixmap
      This method will transform the QML view pixmap into an opengl compatible texture.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        paxl
        wrote on last edited by
        #3

        Thanks for the reply.
        I'm actually using qt5 and qml 2.0 and with the new scenegraph qml items do not inherit from QWidget any longer. However I tried to use a technique similar to yours which is saving the qml in a framebufferobject and then render it as a texture on the 3d object. So far I've managed to save the qml as a framebuffer but I can't find a way to map it on the object yet.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AleksandarJovanov
          wrote on last edited by
          #4

          I do not know how qt5 and qml2 scenegraph api work,but if you can use opengl,
          glTexture2f will do the trick.

          1 Reply Last reply
          0
          • P Offline
            P Offline
            paxl
            wrote on last edited by
            #5

            What I would like to do is implement qml objects that interact between qml items and qt3d items so that I can then easily use qml on 3d objects. Here is a link that discuss it, in the comments at the bottom there's an example : https://bugreports.qt-project.org/browse/QTBUG-19902?attachmentOrder=desc

            Once I find a way to transmit the fbo to the target 3d object then I might use gltexture2f but I'm not there yet.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              AleksandarJovanov
              wrote on last edited by
              #6

              What you are trying to do is not very easy and I do not know of any easy QML way to do it.
              You are trying to have 2D surface that respond to 2D input on 3D surface (cube in your example).
              To do that, you will need to transform the 3D coordinates of the mouse to 2D coordiantes and then use those 2D coordinates in some kind of update method.
              As I said, I am not aware of any easy non C++ method of doing so.
              So you might just have to get native ;)

              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