[vtkusers] Rendering slow with many actors
David Doria
daviddoria at gmail.com
Mon Jul 25 07:23:22 EDT 2011
On Mon, Jul 25, 2011 at 5:40 AM, Jothy <jothybasu at gmail.com> wrote:
> Hi all,
>
> I am adding many actors to the renderer in a for loop.
>
> But the rendering becomes slow, is there any way to make it fast.
> vtkAppendPolyData will not work for me as I want to keep their color
> different.
>
> here is my code
>
> for (int i=0;i<this->NumberOfROIs;i++)
>
> {
>
> double r=this->ROIColors[i][0]/255;
>
> double g=this->ROIColors[i][1]/255;
>
> double b= this->ROIColors[i][2]/255;
>
> vtkActor* axROI=vtkActor::New();
>
> axROI=this->cutAxialROI(this->meshList[i],scrollValue,r,g,b);
>
> this->axialRenderer->AddActor(axROI);
>
> }
>
>
>
>
>
> }
>
>
>
> this->ui->AxialWidget->GetRenderWindow()->Render();
You could set the colors as an array of the CellData and set that
array to be the active scalars. Then you don't need to color the
actor, so the AppendPolyData method should work. You can color the
objects something like this:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/ColoredLines
David
More information about the vtkusers
mailing list