It is much better to use a glyphs for this. Make a vtkPolyData or vtkUnstructuredGrid with the vertices, and optionally a scalar array if you want to vary the size of the spheres. Then make one sphere source and apply the Glyph filter. The glyph filter will instantaite a copy of the sphere at every point, and size each according to the scalar array content for that particular vertex. This way you pay the overhead of having the mapper and actor only once instead of thousands of times.<br>
<br clear="all">David E DeMarle<br>Kitware, Inc.<br>R&D Engineer<br>28 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-371-3971 x109<br>
<br><br><div class="gmail_quote">On Wed, Sep 9, 2009 at 9:27 AM, Arkadiusz Zychewicz <span dir="ltr"><<a href="mailto:oczykota@gmail.com">oczykota@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
i must create many sphers (~10000) but almost all is same. Now i make<br>
one aktor for one sphere, it's no working fine.<br>
<br>
My code:<br>
for (int i = 0; i < P->size(); i++) {<br>
//utworzenie obiektu reprezentujacego linie w vtk<br>
vtkSphereSource* zrodlo = vtkSphereSource::New();<br>
Punkt* pp = P->at(i);<br>
zrodlo->SetCenter(pp->x, pp->y, pp->z);<br>
zrodlo->SetRadius(0.06);<br>
//utworzenie odpowiedniego mappera i przypisanie go do<br>
wlasciwej linii<br>
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();<br>
mapper->SetInputConnection(zrodlo->GetOutputPort());<br>
//utworzenie aktora i przypisanie do niego odpowiedniego mappera<br>
vtkActor *aktor = vtkActor::New();<br>
aktor->SetMapper(mapper);<br>
aktor->GetProperty()->SetColor(cR, cG, cB);<br>
//dodanie aktora na scene.<br>
render->AddActor(aktor);<br>
}<br>
<br>
How put all sphers int one actor?<br>
<br>
A.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br>