[vtkusers] How can I force a vtkRenderer to rerun the pipeline?

Roland Krause rokrau at yahoo.com
Tue May 4 00:55:59 EDT 2010


Is there a way to force an update/rerun of the entire rendering pipeline from a either vtkRenderer or a vtkActor, i.e. if I didn't keep track of all the filters and 
geometry involved? 

I use a vtkWarpVector to show a deformed structure on a (vtkUnstructuredGrid)  and I change the values in the vtkWarpVector but I don't want to rerun vtkGeometryFilter cause it's already slow enough. 

Here is a sketch of how it works: 

         float * dspl = ...;   //  large array with displacements allocated someplace else
         int dsplsize;  // size of the above

         VTK_NEW_PTR(dsplArray,vtkFloatArray);
         dsplArray->SetNumberOfComponents(3);
         dsplArray->SetArray(dspl,dsplsize,1);

         vtkSmartPointer<vtkUnstructuredGrid> & usgrid = ... ; // get that from some function somwhere
 
         vtkPointData * pointData = usgrid->GetPointData();
         pointData->AddArray(dsplArray);
         pointData->SetVectors(dsplArray);

        VTK_NEW_PTR(pGridFilter,vtkGeometryFilter);
        pGridFilter->SetInput(usgrid);

        VTK_NEW_PTR(pWarpVector,vtkWarpVector);
        pWarpVector->SetInput(pGridFilter->GetOutput());
        pWarpVector->SetScaleFactor(warpScaleFactor);

        VTK_NEW_PTR(pPolyData,vtkPolyData);
        pPolyData = pWarpVector->GetPolyDataOutput();

        // Create the "original" mapper
        VTK_NEW_PTR(pMapper,vtkPolyDataMapper);
        pMapper->SetInput(pPolyData);

        VTK_NEW_PTR(pActor,vtkActor);
        pActor->SetMapper(pMapper);

        pRenderer->AddActor(pActor);


Now when it's done I want to change the values in dspl, and rerender the code w/o executing the entire code again  e.g. I'd prefer that 

    pRenderer->GetRenderWindow()->Render();

would render the scene with the actual values in dspl but it does not. 

I've tried calling vtkActor->Modified(), vtkActor->GetMapper()->Modified(), vtkActor->GetMapper()->GetInput()->Modified() but nothing changes. 

Is this because the vtkWarpVector makes copies of the data in dspl? If so, is there a way to prevent that? Any  ideas?

Thanks,
Roland



More information about the vtkusers mailing list