How to load a 3D mesh from an .obj using strictly C++
Unsolved
General and Desktop
-
I have this:
```
//lamp mesh
lampMesh = new Qt3DRender::QMesh();
lampMesh->setSource(QUrl(QStringLiteral("model/lamp.obj")));
auto a = lampMesh->status();//lamp transform lampTransform = new Qt3DCore::QTransform(); lampTransform->setScale3D(QVector3D(0.1,0.1, 0.1)); //lamp material lampMaterial = new Qt3DExtras::QMetalRoughMaterial(); lampMaterial->setBaseColor(QColor(155, 225, 93)); //init lamp lamp = new Qt3DCore::QEntity(root); lamp->addComponent(lampMesh); lamp->addComponent(lampTransform); lamp->addComponent(lampMaterial);
and that is ressources
The mesh doesn't show up and the valu a which represent the status of the mesh always return NONE(0)
What did I do wrong?
-
@Iprahim-Tutuncu said in How to load a 3D mesh from an .obj using strictly C++:
lampMesh->setSource(QUrl(QStringLiteral("model/lamp.obj")));
Check your path.
Try
":/GUI/model/lamp.obj"