[vtkusers] vtkDataSets from 3DS files

justin goyanko gonx1 at yahoo.com
Tue May 13 20:43:57 EDT 2008


Hi,

I'm
currently trying to get some vtkDataSets from 3DS files. From some
similar posts on the mailing list some suggest on getting the data from
the renderer itself.
So far what i've done loading it to the
renderer but i'm still not able to get the data via GetMapper(). I'm
just wondering if i missed something =P

It compiles ok but the program crashes when executed. Using VC++ Express 2008 on windows xp

Below is a sample code:

vtk3DSImporter *importer = vtk3DSImporter::New();
    importer->ComputeNormalsOn();
    importer->SetFileName("C:/vtk3ds_test/bunny.3DS");
    importer->Read();

    vtkRenderWindow* renWin = (importer->GetRenderWindow());
    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWin);

    renWin->SetSize(300, 300);

    vtkRenderer* ren = (importer->GetRenderer());
    ren->SetBackground(0.1, 0.2, 0.4);

    vtkActorCollection *acol = vtkActorCollection::New();
    acol = ren->GetActors();

    vtkActor *actor = vtkActor::New();
    actor = acol->GetLastActor();
    cout << "actor:" << actor->GetClassName() << endl;
    
    vtkOpenGLActor *oglActor = vtkOpenGLActor::New();
    oglActor = (vtkOpenGLActor*)acol->GetLastActor();
    cout << "oglActor: " << oglActor->GetClassName();
    
     oglActor->GetMapper();          (ERROR ON THIS LINE)


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080513/08b60525/attachment.htm>


More information about the vtkusers mailing list