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

QTexture2D not loaded

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15
    • Qt3D
    • None
    • Compiler: MSVC 2019
      Windows 10 x64
    • Windows

    Description

      Description

      We have a Qt3D application where we start rendering using some components in scene graph and then add more components when needed. I encountered a problem that occur only under a very specific circumstance as given below.

      This bug can be reproduced using the following steps:

      • Start rendering (with some components in scene graph)
      • Create a custom material which has a parameter that takes a QTextue2D
      • Create QTexture2D with the custom material as parent during construction
      • Add the texture image and set the parameter of custom material
      aspectEngine->setRootEntity(m_root);
      
      // CustomMaterial inherits from QMaterial
      auto customMaterial = new CustomMaterial(m_entity);
      auto texture2D = new QTexture2D(customMaterial);
      ...
      

      Debugging into Qt3D code, i observed that 'activeTextureHandles' in 'renderer.cpp' doesn't have the texture id. Accessing the texture in GLSL, leads to some undefined behaviour as on some PC's no texture is shown and on some PC's the previously rendered model is shown in place of the texture.

      I mentioned 'very specific circumstance' when describing the bug because, if the QTexture2D is created without a parent or if the QTexture2D->setParent(customMaterial) is set or if QTexture2D (with customMaterial as parent) is created before rendering is started, then the texture is properly shown. Creating QTexture2D with custom material as parent during construction after the rendering has started seems to be the problem.

      It took me a while to figure out where the real problem is. I used 2 Qt versions (Qt 5.15.2 and Qt 5.12.2) to check for this bug. This bug is reproducible only in Qt 5.15.2. On Qt 5.12.2 the texture is displayed properly under all the circumstances.

      I apologize if some of the terminology isn't correct. If the problem isn't clear i would be happy to clarify it in more detail.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            seanharmer Sean Harmer
            qt3d_user ravi patibanda
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes