[prev in list] [next in list] [prev in thread] [next in thread]
List: vtkusers
Subject: [vtkusers] How can I force a vtkRenderer to rerun the pipeline?
From: Roland Krause <rokrau () yahoo ! com>
Date: 2010-05-04 4:55:59
Message-ID: 769903.65305.qm () web81108 ! mail ! mud ! yahoo ! com
[Download RAW message or body]
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
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: \
http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic