- The following code doesn’t show anything
vtkNew<vtkCubeSource> cube_source;
vtkNew<vtkArrowSource> arrow_source;
vtkNew<vtkSphereSource> sphere_source;
vtkNew<vtkMultiPieceDataSet> dataset;
vtkNew<vtkGlyph3DMapper> obj_mapper;
dataset->SetNumberOfPieces(3);
dataset->SetPiece(0, cube_source->GetOutput());
dataset->SetPiece(1, arrow_source->GetOutput());
dataset->SetPiece(2, sphere_source->GetOutput());
obj_mapper->SetUseSourceTableTree(true);
obj_mapper->SetSourceTableTree(dataset);
...
obj_mapper->Update();
but if I modify the code to ↓,it works. Why?
obj_mapper->SetSourceConnection(0, cube_source->GetOutputPort());
obj_mapper->SetSourceConnection(1, arrow_source->GetOutputPort());
obj_mapper->SetSourceConnection(2, sphere_source->GetOutputPort());
- What the difference between SetSourceConnect and SetSourceData?
vtkNew<vtkCubeSource> cube_source;
vtkNew<vtkGlyph3DMapper> obj_mapper;
obj_mapper->SetSourceConnection(cube_source->GetOutputPort()); // This work
obj_mapper->SetSourceData(cube_source->GetOutput()); // This doesn't work