[vtkusers] Modifing a mapper

Mathieu Despriée despriee at enserb.fr
Mon Jul 24 14:30:45 EDT 2000


Seongho Kim wrote:
> 
> Hi,
> 
> I have a question about how to modify a mapper or source for an actor.  In
> my program, I want to modify the geometry of an actor interactively like a
> 3D object drawing tool.
> In the program, a use may drag a mouse to draw or modify an 3D object.  I
> should modify the geometry of an existing actor interactively.
> 
> Here is my question.
> Suppose, I have an actor (actor1) which has been already set by a mapper1.
> Of course the mapper was created by a source (source1).
> 
> Now I want to change the actor1's geometry.  What should I do to do it
> without deleting and recreating the actor1 ?
> If I just create new source and mapper and do actor1->SetMapper(newMapper),
> then I think the previous mapper1 and source1 will remain in the memory.
> Or, If I modify the existing source1 and mapper1 and do
> actor1->SetMapper(mapper1), then I think the reference counts of the mapper1
> and source1 will be increased.  So if I modify the actors geometry
> continuously (like by mouse dragging), then the reference count will be
> continuously increased.
> 
> Can anyone give a good suggestion to me?
> 
> Thanks a lot.
> Bye
> 
> ----------------------------------------------------------------------
> Seongho Kim
> 

Hi,

You can just modify the source of your geometry, without creating new
objects.
For each rendering, the renderer will notice that your source have
changed since the last rendering and will recalculate the whole vtk
pipeline, update the actors, mappers...

The problem with real-time modification like this, is that you can
render the scene :
* either by doing renderer->Render() in a loop (but there will be no
interaction) ;
* or by doing a classical interactor->Start() (but your scene will be
recalculated only with mouse interaction, and not when your source will
change).


I think it would be very useful to have an Interactor that would start a
new rendering in both cases : mouse interaction or modification of the
source. (If I could find the time, maybe I will try to do something like
this)




Hope this help.

-- 
Guz
----------------------
mailto:despriee at free.fr




More information about the vtkusers mailing list