vtkSmartVolumeMapper doesn't properly handle input changes
Hi,
I have found an issue with vtkSmartVolumeMapper
. If you create several vtkImageData
objects, set one of them as the input of the mapper and render, then you won't be able to render one of the others at a later time: if you set one of the others as input the mapper will keep rendering the first one.
The issue is in the method vtkSmartVolumeMapper::ConnectMapperInput
. It doesn't pass the original input to its internal mapper, but a shallow copy of it. The first time it will always perform the shallow copy, but afterwards it will only do it if the new input has been modified after creating the previous shallow copy, which is not always the case (e.g. if you create all the data before the first render).
Possible workarounds are to call Modified()
on the input data when setting a new one or to create a new mapper each time.
I have attached a sample program (adapted from a couple of examples) to proof the issue. Pressing 1 or 2 alternates between 2 datasets but only the first one is always rendered. Uncommenting the two Modified()
calls makes it work as expected.