Important: Please read the Qt Code of Conduct -

How to extract triangles out of mesh geometry

  • I'm creating meshes with Qt3D. I check if the mesh is actually built with triangles:

    qDebug() << "mesh primitive type: " << mesh->primitiveType();

    which returns:


    Therefore, my mesh primitive type is definitely triangle.

    Now I'm trying to access to triangles of the mesh, but I don't know how. There is the following API to get the data and its type which can be either VertexBuffer or IndexBuffer:


    But I don't know how to extract triangles one-by-one using the above APIs. Can anybody help me.

    Eventually, I'm going to export the triangles as STL file with such a format. Is there any API to export mesh as STL? I'm using Qt 5.9.4

Log in to reply