Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to load a 3D mesh from an .obj using strictly C++
Forum Updated to NodeBB v4.3 + New Features

How to load a 3D mesh from an .obj using strictly C++

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 252 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Iprahim Tutuncu
    wrote on last edited by
    #1

    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
    test.png

    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?

    Pl45m4P 1 Reply Last reply
    0
    • I Iprahim Tutuncu

      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
      test.png

      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?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @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"


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved