[vtkusers] pipeline execution problem

Dean Inglis dean.inglis at sympatico.ca
Tue Oct 27 17:19:34 EDT 2009


I have the following scenario:

class myFoo: vtkObject
{
  vtkPolyData* GetmyLine(){return myLine;}
  void SomehowBuildmyLine();
  void SomehowBuildmyLineDifferently();
private:
  vtkPolyData* myLine;
}

void main()
{
myFoo* foo = myFoo::New();
foo->SomehowBuildmyLine();

vtkActor* actor = vtkActor::New();
vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
mapper->SetInput( foo->GetmyLine() );
actor->SetMapper( mapper);

// place the actor in a renderer and render it
//
vtkRenderer* ren = vtkRenderer::New();
ren->AddViewProp( actor );
ren->Render();

// change the points and cells that make myLine without
// deleting myLine
//
foo->SomehowBuildmyLineDifferently();

// try and render to see the changes
//
ren->Render();


At this point, I don't see any changes, even if myLine
has calls Modified() during its second build method.
I have tried 
  mapper->Modified();
  mapper->Update()
  ren->Render();

but I don't see the changes. In fact, if I do a check:

bool match = mapper->GetInput() == foo->GetmyLine();

match evaluates to false.

Since myLine is not generated by a vtkAlgorithm, how do I keep
the pipeline connected without having to explicitly to call
mapper->SetInput( foo->GetmyLine() );

every time a change is made to myLine???

Dean








More information about the vtkusers mailing list