I've been trying to update the color of a GLMeshItem in a 3d pyqtgraph plot with some success. Using the setColor() member of the GLMeshItem class, I can set the color initially, and sometimes, the face color of the mesh will update, but not always.
I've had this working in the past, so I know it is possible to do, but can't seem to figure it out this time. According to the documentation, setColor() will Set the default color to use when no vertex or face colors are specified. I'm a bit confused as to whether this means I can dynamically change colors, or only set the color initially.
For context, I have a 3d plot with a mesh in it. I read date from a file, then want to set the color of the mesh based on that data. I can post more code if needed, but my program is several hundred lines long and would be tricky to extract the necessary bits to make to problem reproducible. If it would help I can definitely do that however. For now here is the line I am using to set the color:
_mesh_model is a GLMeshItem.
Color is a tuple of the form (R, G, B, Alpha)
self._mesh_model.setColor(color)
Ok after some searching I figured it out.
Instead of self._mesh_model.setColor(color), where color is a tuple in the form RGBA, I used this: QtGui.QColor(R, G, B) where R, G and B are values between 0 and 255.
Now the mesh color updates as expected.
Updating the color of a GLMeshItem