Is it better to add / remove vtkActors or toogle their visibility?

I am writing a GUI to display vtkUnstructuredGrid containing several scalars and vectors. The goal is to allow the user to decide whether he wants to display a color map or a vector field of glyphs, or only himself.

This gives me basically four actors: one for the map, one for the glyphs, one for the grid, and the last for the color panel. Depending on the user's choice, I need to display either only a grid, or a map, and a color panel, or glyphs, and a color panel. I can prepare each actor myself and save them as an attribute of my GUI for later access.

I am wondering what is the most efficient approach for rendering only what the user wants:

  • switches the visibility of each actor depending on the use case (using .SetVisibility(True/False) ) or

  • add / remove relevant members to / from vtkRenderer .

Any insight would be appreciated.

--- Edit ---

Consequence: when a vtkRenderer renders to actors, do they skip the invisible or create them, and then hide them?

+4
source share
1 answer

Have you noticed a difference in performance or something else? I would say that these two methods should do the same at runtime.

0
source

All Articles