I’m writing a GUI to display a vtkUnstructuredGrid containing several scalars and vectors. The objective is to let the user decide whether s/he wants to display a color map, or a vector field of glyphs or just the mesh itself.
That gives me basically four actors: one for the map, one for the glyphs, one for the mesh and a last one for the colorbar. Depending on the user’s choice, I need to display either the mesh alone, or the map and the colorbar, or the glyphs and the colorbar. I can prepare each actor independently and store them as an attribute of my GUI for a later access.
I’m wondering what is the most efficient approach for rendering only what the user wants:
-
toggling the visibility of each actor depending on the use case (using a
.SetVisibility(True/False)), or -
adding/removing the corresponding actors to/from the
vtkRenderer.
Any insight will be greatly appreciated.
— Edit —
A corollary is : when a vtkRenderer renders actors, does it skip the invisible ones or does it renders them, then hides them ?
Have you noticed a performance difference or something? I would have said those two techniques should do exactly the same thing at runtime.