<div dir="ltr"><div><div><div><div><div><div><div><div><div>Hi, <br><br></div>From this example, <a href="http://vtk.org/gitweb?p=VTK.git;a=blob;f=Rendering/OpenGL/Testing/Cxx/TestMultiblockDisplayProperties.cxx">http://vtk.org/gitweb?p=VTK.git;a=blob;f=Rendering/OpenGL/Testing/Cxx/TestMultiblockDisplayProperties.cxx</a><br>
</div>It shows how to color each block on a multiblockdataset, but this dataset is get from a reader:<br></div>vtkXMLMultiBlockDataReader<br><br></div>Then the key line is: <br>mapper->SetInputConnection(reader->GetOutputPort()); <br>
then it works, i can see different colors on different blocks.<br><br></div>But in my case, say, I already have a vtkMultiBlockDataSet *mb in my code, so I don't need to use any reader. Then this is what I did:<br><br>
</div>vtkCompositeDataGeometryFilter *sgfilter = vtkCompositeDataGeometryFilter::New();<br>sgfilter->SetInputData(mb);<br>sgfilter->Update();<br>mapper->SetInputConnection(sgfilter->GetOutputPort());<br><br></div>
But it doesn't work, I cannot see different colors as I expected.<br><br></div>So, what should I do in my case in order to use vtkCompositeDataDisplayAttributes class to show different colors in different blocks.<br><br>
</div>Thanks in advance.<br><br>Chao<br></div>