[vtkusers] ply to vrml conversion problem

poyo scj90 at dvis.cs.ccu.edu.tw
Mon Mar 4 02:28:18 EST 2002


#include <vtk/vtkPLYReader.h>
#include <vtk/vtkPolyDataMapper.h>
#include <vtk/vtkVRMLExporter.h>
#include <vtk/vtkRenderWindowInteractor.h>
#include <iostream.h>
#include <stdlib.h>

int main(int argc,char **argv)
{
/* if(argc != 3)
 {
  cout<<"Need input file name!"<<endl;
  exit(1);
 }*/
 vtkRenderWindow *renWin = vtkRenderWindow::New();
 vtkRenderWindowInteractor *interactor = vtkRenderWindowInteractor::New(); 
 vtkRenderer *ren = vtkRenderer::New();
 renWin->AddRenderer(ren);
 interactor->SetRenderWindow(renWin);
   
 vtkPLYReader *Reader = vtkPLYReader::New();
 Reader->SetFileName("g0.ply");//argv[1]); 
 Reader->Update();
  
 vtkPolyDataMapper *Mapper = vtkPolyDataMapper::New();
 Mapper->SetInput(Reader->GetOutput());
  
 vtkActor *Actor = vtkActor::New();
 Actor->SetMapper(Mapper);
  
 ren->AddActor(Actor);
 ren->SetBackground(0.1, 0.2, 0.4);
 interactor->Initialize();
// cout<<"1"<<endl;
 renWin->Render();
// cout<<"2"<<endl;
 interactor->Start();
// cout<<"3"<<endl;
    
 vtkVRMLExporter *exp = vtkVRMLExporter::New();
 exp->SetRenderWindow(renWin);
 exp->SetFileName(argv[2]);
// cout<<"11"<<endl;
 exp->Write();
// cout<<"111"<<endl;
 return 0;
}

runtime error message:
"unhandle exception in plytovrml.exe(vtkio.dll):0xc0000005:access violation"

does somebody tell me where the bug is? or show me another example.  Thank you!!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020304/3bd10c59/attachment.htm>


More information about the vtkusers mailing list