I am trying to color the mesh, and RGB represents the three vectors of the mesh.
I am trying to understand the sample program in github.
I think I need to use cmdSampleMeshFaceColor, SampleCustomMeshObjects and cmdSampleGetPointOnMesh.cpp.
But after I use cmdSampleMeshFaceColor, I find that the coloring can’t be saved,
cancel gs.GetString(); the color will disappear immediately.
Can I have a better solution to this problem or any example for it?
I will be grateful for any help you can provide !
Meshes do not have face colors. However, you can draw meshes with face color using a conduit. This is what the example demonstrates.
That said meshes can have vertex colors. To create a mesh with vertex colors, just fill in the
ON_Mesh::m_C array with RGB colors that correspond to vertices.
@dale Thanks for your reply.
When I use the example cmdSampleMeshFaceColor , the coloring can’t be saved.
And cancel gs.GetString(); the color will disappear immediately.
What can I do to always keep the color ?
In the sample you reference, the conduit is created on the stack. Thus when the command end, the conduit is destroyed. If you want the conduit to persist, then add it as a member variable to the command, or allocate it on the heap.
Thank you very much @dale
It is help for me.
I will continue to try vertex colors .