Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Using QImage as Texture in Qt3D

Using QImage as Texture in Qt3D

Scheduled Pinned Locked Moved Unsolved Game Development
5 Posts 4 Posters 1.8k 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.
  • DabullaD Offline
    DabullaD Offline
    Dabulla
    wrote on last edited by
    #1

    Hi,

    I was searching for a solution to load custom pixels from C++ into Qt3D as a Texture.

    Approaches:

    1. I have a working QQuickImageProvider with URLs like "image://myImageProvider/someId" working. When I give these Urls to a Qt3D TextureImage I get an error "QTextureImage only supports local url".
    2. I tried using Scene2D and load an oldfashioned Image-Item. This does work, but I run into an error when using Scene2D in a NodeInstantiator (maybe this bug: https://bugreports.qt.io/browse/QTBUG-67635)
    3. Currently I am implementing a Qt3DRender::QTextureGenerator and Qt3DRender::QAbstractTexture. Now I think I need to use Qt private Headers to access Qt3DRender::QAbstractTexturePrivate and it's "setDataFunctor"-Method.

    Before contiuing this (quite painful) path, I wanted to ask for simpler solutions I might overlooked. Any ideas?

    Thanks in advance

    1 Reply Last reply
    0
    • DabullaD Offline
      DabullaD Offline
      Dabulla
      wrote on last edited by
      #2

      I've got a workaround to get approach 2) working.

      A solution is, to use a repeater inside one single Scene2D in addition to the NodeInstantiator.
      I then render all needed images using an image-providers.
      NodeInstantiator uses the Scene2D as a "TextureAtlas" and cutts out the repeated images as needed.

      1 Reply Last reply
      2
      • A Offline
        A Offline
        Andreas E.
        wrote on last edited by
        #3

        I use Qt3DRender::QPaintedTextureImage to paint QImage objects onto Qt3DRender::QTexture2D from C++. But I don't know if you can access that on QML level in a convenient way.

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

          @Andreas-E could you please give us a short C++ example of how you implement your idea with QTexture2D and QPaintedTextureImage in the same time ? Could help me a lot !

          1 Reply Last reply
          0
          • A Offline
            A Offline
            amzounslideslide
            Banned
            wrote on last edited by amzounslideslide
            #5
            This post is deleted!
            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