[vtkusers] Speed up vtkRenderer::AddActor

Karthik Krishnan karthik.krishnan at kitware.com
Thu Jul 8 04:37:51 EDT 2010


Add them to the collection yourself if you don't like the checks that
vtkRenderer imposes. Something like :

vtkPropCollection *coll = renderer->GetViewProps();
foreach(prop) {
  prop->AddConsumer(renderer);
  coll->AddItem();
}

That said, you will experience an enormous drag with a million actors. The
overhead of a million mappers - actors - properties is way too much.

You should come up with a composite data or geometry representation that
would not necessitate a million actors.

--
karthik

On Thu, Jul 8, 2010 at 1:22 PM, Yang Yang <yyang109 at gmail.com> wrote:

> Dear users,
> I wonder if there is a way to speed up the method vtkRenderer::AddActor. I
> found that when I call vtkRenderer::AddActor(vtkProp*), it will in turn callvtkViewport::AddViewProp(vtkProp*),
> vtkViewport::HasViewProp(vtkProp*) and then
> vtkCollection::IsItemPresent(vtkObject*). In IsItemPresent method it loops
> over all the existing actors and check if the argument actor already exists.
> If I want to add for example a million actors to the renderer, this check
> will take a huge amount of time. However I don't need this check, because in
> my code in the higher level I garanteed that there will be no duplicate
> actors added to the renderer. So My question is, is there any way to bypass
> the check  IsItemPresent when calling vtkRenderer::AddActor? or is there any
> other fast way to add a huge number of actors to the renderer?
>
> Any suggestion or clue is highly appreciated!
>
> Best
> Yang
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100708/9de08cf2/attachment.htm>


More information about the vtkusers mailing list