Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-65775

QTexture with TextureImage from file - or a QTextureLoader that shares the texture internally - does not report any sensible width/height/etc.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.9, 5.10, 5.11
    • Qt3D
    • None

    Description

      Have code like this:

          Qt3DRender::QTexture2D *texture = new Qt3DRender::QTexture2D(m_rootEntity);
          Qt3DRender::QTextureImage *textureImage = new Qt3DRender::QTextureImage;
          textureImage->setSource(QUrl::fromLocalFile(source));
          texture->addTextureImage(textureImage);
      

      then try to query width(), height(), and others from texture or the texture image. The result (at least for width and height) is always 1.

      Not reporting the actual width and height is a dealbreaker for some cases. For example, imagine a shader that expects data derived from the texture size as its input. Or, any debug/profile view that tries to report the sizes of the textures used.

      Update: I realized in the meantime that QTextureLoader works fine and that will update width and height as expected.

      Update2: actually, QTextureLoader is still a problem when the same file is referenced by multiple QTextureLoaders. In that case only the first one (that does the actual file loading) gets updated property values, the others are stuck with 1x1 etc.

      The ideal solution would be to get up-to-date values for width, height, etc., and introducing a new flag indicating if the texture uses shared data under the hood (keeping in mind that two QTextureLoaders with the same source lead to reusing the data itself but will still generate two separate textures if some texture parameters (say wrap mode) differ)

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-65775
          # Subject Branch Project Status CR V

          Activity

            People

              lemire_p Paul Lemire
              lagocs Laszlo Agocs
              Votes:
              4 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes