It should work as you expect. Something else is going on. Can you post a small, compilable example that illustrates the problem?<br><br>Bill<br><br><div class="gmail_quote">On Mon, Apr 11, 2011 at 11:18 AM, Pascal Augustin <span dir="ltr"><<a href="mailto:pascal@rogue-research.com">pascal@rogue-research.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;">Hi, <div><br></div><div><div>Let's assume I have two actors with exactly the same shape. To avoid creating the vtkPolyData and vtkPolyDataMapper twice, I decided to let both actors share the same vtkPolyDataMapper.</div>
<div><br></div><div>vtkSmartPointer<vtkPolyDataMapper> sphereMapper = ...</div><div><br></div><div><br></div><div>// Sphere</div><div>vtkSmartPointer<vtkActor> sphereActor1 = ...</div><div>sphereActor1->SetMapper(sphereMapper);</div>
<div><br></div><div>// Sphere</div><div><div>vtkSmartPointer<vtkActor> sphereActor2 = ...</div><div>sphereActor2->SetMapper(sphereMapper);</div><div><br></div><div><br></div><div>// Cube</div><div>vtkSmartPointer<vtkPolyDataMapper> cubeMapper = ...</div>
<div><div>vtkSmartPointer<vtkActor> cubeActor = ...</div><div>cubeActor->SetMapper(cubeMapper);</div></div><div><br></div><div>I was expecting sphereActor1 and sphereActor2 to be displayed as spheres while cubeActor would be a cube. Here is what I sometimes get:</div>
<div><br></div><div>sphereActor1 ---> sphere</div><div>sphereActor2 --> sphere </div><div>cubeActor ---> *** sphere*** </div><div><br></div><div>The cubeActor seems to be using the shereMapper. It has the correct position, color, scale, etc. Only the shape is wrong.</div>
<div><br></div><div>I can avoid this problem by doing this:</div><div>sphereMapper-><span style="font-family: Monaco; font-size: 12px;">ImmediateModeRenderingOn();</span></div><div><font face="Monaco"><br></font></div>
<div>Doing a shallowCopy also seems to prevent that bug from happening:</div><div>vtkSmartPointer<vtkPolyDataMapper> sphereMapper1 = vtkSmartPointer<vtkPolyDataMapper>::New();</div><div>sphereMapper1->ShallowCopy(sphereMapper);</div>
<div>sphereActor1->SetMapper(sphereMapper1);</div><div><br></div><div>Am I missing something? Can multiple actors safely share the same mapper?</div><div><br></div><div>Thanks!</div><div><br></div><div>I am using VTK 5.7 on Mac OS X 10.6.7.</div>
<div><br></div><div>______________________</div><div><div style="word-wrap: break-word;"><div style="word-wrap: break-word;">Pascal Augustin</div><div style="word-wrap: break-word;">Rogue Research Inc.<br>Montreal (Quebec), Canada<br>
<a href="http://www.rogue-research.com" target="_blank">www.rogue-research.com</a><br><br></div></div>
</div>
<br></div></div></div><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>
<br></blockquote></div><br>