[vtkusers] can't add PropAssembly to PropAssembly

Mathieu Malaterre mathieu.malaterre at kitware.com
Thu Mar 17 17:54:03 EST 2005


Chris,

	Could you open a bug in the bug tracker (*) and copy/paste your code.

Thanks
Mathieu
(*) http://vtk.org/Bug

Christopher.Moore at noaa.gov wrote:
> The documentation says that a PropAssembly can contain other PropAssemblies, but
> my code seg faults when I try this.
> 
> I create two PropAssemblies, one with a ConeSource and one with a SphereSource, 
> add them to the render, this works.
> 
> I create two PropAssemblies, one with a ConeSource AND a SphereSource, and then 
> add this to the second PropAssembly -> run-time error "segmentation fault".
> 
> Any ideas?  Short code segment below.
> 
> Cheers,
> Chris
> 
> __________________________________________________________________
> Christopher Moore                email: Christopher.Moore at noaa.gov
> Research Scientist, Oceanography                 tel: 206.526.6779
> University of Washington/JISAO/NOAA-PMEL         fax: 206.526.6744
> ------------------------------------------------------------------
> 
> #include "vtkConeSource.h"
> #include "vtkSphereSource.h"
> #include "vtkPolyDataMapper.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderWindowInteractor.h"
> #include "vtkCamera.h"
> #include "vtkPropAssembly.h"
> #include "vtkActor.h"
> #include "vtkRenderer.h"
> 
> int main( int argc, char *argv[] )
> {
> 
>   vtkRenderer *ren1= vtkRenderer::New();
>   vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>   vtkRenderWindow *renWin = vtkRenderWindow::New();
>   renWin->AddRenderer( ren1 );
>   renWin->SetSize( 300, 300 );
>   iren->SetRenderWindow( renWin );
> 
>   // make a cone
>   vtkConeSource *cone = vtkConeSource::New();
>   vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
>   coneMapper->SetInput( cone->GetOutput() );
>   vtkActor *coneActor = vtkActor::New();
>   coneActor->SetMapper( coneMapper );
> 
>   // make a sphere
>   vtkSphereSource *sphere = vtkSphereSource::New();
>   vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
>   sphereMapper->SetInput( sphere->GetOutput() );
>   vtkActor *sphereActor = vtkActor::New();
>   sphereActor->SetMapper( sphereMapper );
> 
>   // this works:
> //    ren1->AddProp( coneActor );
> //    ren1->AddProp( sphereActor );
> 
> 
>   // this works:
> //   vtkPropAssembly *pa1 = vtkPropAssembly::New();
> //   pa1->AddPart(coneActor);
> //   vtkPropAssembly *pa2 = vtkPropAssembly::New();
> //   pa2->AddPart(sphereActor);
> //   ren1->AddProp(pa1);
> //   ren1->AddProp(pa2);
> 
>   // this doesnt (seg faults):
>    vtkPropAssembly *pa1 = vtkPropAssembly::New();
>    pa1->AddPart(coneActor);
>    pa1->AddPart(sphereActor);
>    vtkPropAssembly *pa2 = vtkPropAssembly::New();
>    pa2->AddPart(pa1);
>    ren1->AddProp(pa2);
> 
> 
>   iren->Start();
> 
> }
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 




More information about the vtkusers mailing list