Results 1 to 10 of 10

Thread: App crashes when I try to get the position attribute of a QMesh (Qt 5.15.2)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default App crashes when I try to get the position attribute of a QMesh (Qt 5.15.2)

    I try to get the position attribute of a mesh using the following code

    Qt Code:
    1. ....code...
    2. Qt3DRender::QMesh *mesh = new Qt3DRender::QMesh();
    3. mesh->setMeshName("mesh");
    4. // Import mesh data from a ply file (monster.ply located at same level of the executable)
    5. mesh->setSource(QUrl::fromLocalFile("monster.ply"));
    6.  
    7. // The call to mesh->geometry() crashes my app
    8. if (mesh->primitiveType() == Qt3DRender::QGeometryRenderer::Triangles)
    9. {
    10. for(int i = 0; i < mesh->geometry()->attributes().size(); ++i)
    11. {
    12. // To have access to data
    13. mesh->geometry()->attributes().at(i)->buffer()->setSyncData(true);
    14. }
    15.  
    16. // Now I need to get the position of the vertices of the triangles
    17.  
    18. Qt3DRender::QAttribute *positionAttribute = mesh->geometry()->attributes().at(0);
    19. ...more code...
    20. }
    To copy to clipboard, switch view to plain text mode 

    This is the content of the qmake script
    Qt Code:
    1. QT += 3dcore 3drender 3dinput 3dextras
    2. QT += widgets
    3.  
    4. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 


    I am using Qt5 LTS version.
    Am I forgetting some plugins or am I doing something wrong?
    I don't understand why I am getting such runtime error.

    Franco
    Last edited by franco.amato; 27th March 2023 at 19:59. Reason: updated contents
    Franco Amato

Similar Threads

  1. Attribute files
    By SirJonas in forum General Programming
    Replies: 1
    Last Post: 2nd November 2016, 20:24
  2. Replies: 0
    Last Post: 1st August 2016, 08:51
  3. How to set an attribute without affecting children?
    By dominate in forum Qt Programming
    Replies: 0
    Last Post: 15th February 2011, 14:58
  4. Updating xml attribute
    By steg90 in forum Qt Programming
    Replies: 3
    Last Post: 17th July 2007, 09:26
  5. Replies: 1
    Last Post: 22nd January 2007, 09:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.