Unsolved QT3D: How to apply a 2D Texture on a Mesh?
-
Hi,
In a first version of my application, I applied a 2D texture on a QCuboidMesh using the simple code:Qt3DExtras::QCuboidMesh * background2DView = new Qt3DExtras::QCuboidMesh; ... Qt3DExtras::QTextureMaterial *backgroundMaterial = new Qt3DExtras::QTextureMaterial; Qt3DRender::QTexture2D * backgroundTexture = new Qt3DRender::QTexture2D(backgroundMaterial); Qt3DRender::QTextureImage * backgroundImage = new Qt3DRender::QTextureImage(backgroundMaterial); backgroundImage->setSource(QUrl("qrc:/Resources/Img/Contrast/test.png")); backgroundTexture->addTextureImage(backgroundImage); backgroundMaterial->setTexture(backgroundTexture); backgroundEntity->addComponent(background2DView); backgroundEntity->addComponent(backgroundMaterial);
And this code works well. No I have to change to use a custom mesh. But, texture is not correctly applied to it. It seems that texture coordinates used for the display are always (0,0). I tried to find an sample to help me. But, I find nothing (unfortunately a lot of web sites are blocked by our internal security rules). So, if someone can help me by giving me the right piece of code for my problem.
Thanks a lot in advance.