How to export an OF_PRIMITIVE_TRIANGLE_STRIP to .ply?

Hi, is there a simple way to export a triangle strip to .ply?

I’m using ofxPoly to give thickness to polylines. It creates meshes which display fine in OF, but if you save them to .ply they only contain vertices, no faces. Loaded in blender they are just a set of points.


I can rewrite the code to export triangles, but I’m wondering if there’s an simpler approach? And what’s the issue? Maybe the exporter not knowing what to do with strips?

Yes i think the exporter only knows how to export triangles, it should at least fail if it detects that the mesh is not a triangle mesh.

It was easy to implement. This PR makes it work for me:

I’ll be happy to receive feedback on it.

1 Like

I’ll post one more solution to convert a triangle-strip-mesh into a triangles-mesh by producing indices while keeping the vertices untouched. In case anyone has use for it.

void stripToTriangles(ofMesh & m) {
    u_int numVert = static_cast<u_int>(m.getNumVertices());
    if(m.getMode() == OF_PRIMITIVE_TRIANGLE_STRIP && numVert >= 4) {
        for(u_int i = 0; i < numVert - 2; i += 2) {
            m.addIndices({ i, i + 1, i + 2, i + 3, i + 2, i + 1 });