[vtkusers] VTK 6 vtkCompositeDataDisplayAttributes

Kyle Lutz kyle.lutz at kitware.com
Thu Aug 15 17:36:41 EDT 2013


On Thu, Aug 15, 2013 at 5:16 PM, Chao Liang <chaolian at mtu.edu> wrote:
> Hi,
>
> From this example,
> http://vtk.org/gitweb?p=VTK.git;a=blob;f=Rendering/OpenGL/Testing/Cxx/TestMultiblockDisplayProperties.cxx
> It shows how to color each block on a multiblockdataset, but this dataset is
> get from a reader:
> vtkXMLMultiBlockDataReader
>
> Then the key line is:
> mapper->SetInputConnection(reader->GetOutputPort());
> then it works, i can see different colors on different blocks.
>
> 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:
>
> vtkCompositeDataGeometryFilter *sgfilter =
> vtkCompositeDataGeometryFilter::New();
> sgfilter->SetInputData(mb);
> sgfilter->Update();
> mapper->SetInputConnection(sgfilter->GetOutputPort());
>
> But it doesn't work, I cannot see different colors as I expected.
>
> So, what should I do in my case in order to use
> vtkCompositeDataDisplayAttributes class to show different colors in
> different blocks.
>

Hi Chao,

Are you sure you're setting the block attributes correctly? For
instance the line "mapper->SetBlockColor(67, 0, 0.33, 0.0);" will set
the color for block #67 to green. If your data set doesn't have a
block with that ID then nothing will happen.

If that doesn't work can you post your full code?

Thanks,
Kyle



More information about the vtkusers mailing list