Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to create and apply texture to object in C++ or Python?(Qt 3D)



  • I am struggling to create and apply basic texture in Qt. I suppose it should be one line of code, but for some reason it is very complicated and poorly documented. I am trying to use QDiffuseSpecularMaterial Class but its maps are of QVariant type. I suppose I should use QAbstractTexture Class to load the textures and then convert them to QVariant somehow. Problem is that QAbstractTexture Class doesn't have any method that loads the texture. There is an addTextureImage method but its argument is QAbstractTextureImage Class that still doesn't have any load method. Even if I could load the texture somehow I have no idea how to convert them to QVariant. Does anyone know how to create and apply any basic image to the any basic 3D object? Is it possible to use QImage or QPixmap and conver them to Textures or QVariant somehow?


Log in to reply