Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9, 5.10, 5.11
-
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
- relates to
-
QT3DS-660 Qt 3D bugs and features required for Runtime 2
- Withdrawn