I tried to change some vertices in the mesh to red by CGAL, and show it in Meshlab.
I tried :
Surface_mesh::Property_map<Surface_mesh::Vertex_index, CGAL::Color> vcolors =
mesh.property_map<Surface_mesh::Vertex_index, CGAL::Color >("v:color").first;
std::vector<Surface_mesh::Vertex_index>::iterator v_iter;
for (v_iter = borderVertex.begin(); v_iter != borderVertex.end(); v_iter++)
{
std::cout << *v_iter << " ";
vcolors[*v_iter] = Color(255, 0, 0);
}
Although the color has been adjusted to the vertex option,I can't see any red vertex in Meshlab. The output .off is black.
Thank you and have a nice day.
Please ensure that colors are stored in the .off exported file. You can verify this reading the first line of the .off file, which should begin with the "COFF" word.
If the file begins with "OFF", then the color information is not in the file.
Also, note that OFF files spect RGBA values are integers in the 0 .. 255 range, not floats in 0.0 .. 1.0 range.
Here is a example of a valid OFF file with per-vertex colors that you can use to test meshlab.
COFF
3 1 0
1220.094 -572.5 77.71394 255 0 0 255
1291.572 -609.4396 28.62849 0 255 0 255
1251.572 -609.4396 38.62849 255 255 255 255
3 0 1 2
If in doubt, I would export the file into .ply file format.