Good morning I'm Paul and I'm trying to show a mesh but it does not work, you have to put a texture on it?

Main.cpp
Qt Code:
  1. #include <Qt3DQuickExtras/qt3dquickwindow.h>
  2. #include <Qt3DQuick/QQmlAspectEngine>
  3.  
  4. #include <QGuiApplication>
  5. #include <QtQml>
  6.  
  7. int main(int argc, char **argv)
  8. {
  9. QGuiApplication app(argc, argv);
  10. Qt3DExtras::Quick::Qt3DQuickWindow view;
  11.  
  12. // Expose the window as a context property so we can set the aspect ratio
  13. view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view);
  14. view.setSource(QUrl("qrc:/main.qml"));
  15. view.setWidth(800);
  16. view.setHeight(600);
  17. view.show();
  18.  
  19. return app.exec();
  20. }
To copy to clipboard, switch view to plain text mode 

Main.qml
Qt Code:
  1. import Qt3D.Core 2.0
  2. import Qt3D.Render 2.0
  3. import Qt3D.Input 2.0
  4. import Qt3D.Extras 2.0
  5.  
  6. Entity {
  7. id: sceneRoot
  8.  
  9. Camera {
  10. id: camera
  11. projectionType: CameraLens.PerspectiveProjection
  12. fieldOfView: 25
  13. aspectRatio: _window.width / _window.height
  14. nearPlane : 0.1
  15. farPlane : 1000.0
  16. position: Qt.vector3d( 0, 0.0, 20.0 )
  17. upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
  18. viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
  19. }
  20.  
  21. OrbitCameraController {
  22. camera: camera
  23. }
  24.  
  25. components: [
  26. RenderSettings {
  27. activeFrameGraph: ForwardRenderer {
  28. clearColor: Qt.rgba(0, 0.5, 1, 1)
  29. camera: camera
  30. }
  31. },
  32. InputSettings { }
  33. ]
  34.  
  35. PhongMaterial {
  36. id: carMaterial
  37. }
  38.  
  39. Mesh {
  40. id: carMesh
  41. source: "SferaStl.stl"
  42. }
  43.  
  44. Entity {
  45. id: carEntity
  46. components: [ carMesh, carMaterial ]
  47. }
  48. }
To copy to clipboard, switch view to plain text mode 

File.pro

Qt Code:
  1. QT += 3dextras widgets 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
  2. CONFIG += c++11
  3.  
  4. # The following define makes your compiler emit warnings if you use
  5. # any feature of Qt which as been marked deprecated (the exact warnings
  6. # depend on your compiler). Please consult the documentation of the
  7. # deprecated API in order to know how to port your code away from it.
  8. DEFINES += QT_DEPRECATED_WARNINGS
  9.  
  10. # You can also make your code fail to compile if you use deprecated APIs.
  11. # In order to do so, uncomment the following line.
  12. # You can also select to disable deprecated APIs only up to a certain version of Qt.
  13. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
  14.  
  15. SOURCES += main.cpp
  16.  
  17. RESOURCES += qml.qrc\
  18.  
  19.  
  20.  
  21. # Additional import path used to resolve QML modules in Qt Creator's code model
  22. QML_IMPORT_PATH =
  23.  
  24. # Additional import path used to resolve QML modules just for Qt Quick Designer
  25. QML_DESIGNER_IMPORT_PATH =
  26.  
  27. # Default rules for deployment.
  28. qnx: target.path = /tmp/$${TARGET}/bin
  29. else: unix:!android: target.path = /opt/$${TARGET}/bin
  30. !isEmpty(target.path): INSTALLS += target
  31.  
  32. DISTFILES += \
  33. main.qml \
  34.  
  35. SUBDIRS += \
  36. untitled1.pro
To copy to clipboard, switch view to plain text mode 

The program starts and the window appears but you do not see the mesh that is located on the root