openframeworks / openframeworks/openFrameworks
ofMesh::save outputs invalid indices / ofMesh::load out of range
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
While investigating the problem #2944, I noticed this ofMesh::load crash is due to ofMesh::load/save parsing. If I load a ply file generated by ofMesh::save of Mac oF 0.8.0, debugger gives vector out of range error at getVertices on Visual Studio (weird but no problem on Xcode). I saved a pointcloud w/o faces; however, ofMesh appends ceil(numVertices / 3) number of faces to the ply file, which may contain invalid vertex indices because default ofMesh mode is GL_TRIANGLES.
So probably changes are needed to
ofMesh::save:
https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/3d/ofMesh.cpp#L1027
https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/3d/ofMesh.cpp#L1083
ofMesh::load:
https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/3d/ofMesh.cpp#L909
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in libs/openFrameworks/3d/ofMesh.cpp at the referenced getVertices, save, and load locations. Reproduce with a point cloud without faces, saved as PLY by ofMesh on Mac openFrameworks 0.8.0, then inspect the generated face indices and load behavior in Visual Studio. Done means saved PLY files do not contain invalid indices and loading them does not go out of range.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100