[vtkusers] rendring problem
medamine
miladimedamine at yahoo.fr
Fri Jun 22 04:38:17 EDT 2007
Thanks
do you mean vtkIdTypes?because using vtkCellType i get an error that did not
exist(vtkCellType.h is included).
so i do this:
vtkIdTypes cellId = i;
m_polydata->InsertNextCell(VTK_VERTEX, 1, &cellId);
but, the debugger is declanched.
Amy Squillacote wrote:
>
> In VTK, you must have cells to render. If your dataset only contains
> points and you want to render points, you will need to create a
> vtkVertex cell per point in your dataset. The code to do that would look
> something like the following.
>
> Inside your while loop, before the line "i++;", add these lines.
>
> vtkCellType cellId = i;
> m_polydata->InsertNextCell(VTK_VERTEX, 1, &cellId);
>
> - Amy
>
> medamine wrote:
>> Hi;
>> i'm trying to create a mesh from .txt file in witch i have only
>> points.after
>> creation i get a mesh with 1024 pts but nothing appear in the screan when
>> rendring.
>> Thanks
>>
>> FILE *fp;
>> float x=0;
>> float y=0;
>> float z=0;
>> const float p[3]={0,0,0};
>> char *c;
>> int i=0;
>> vtkPolyData *m_polydata=vtkPolyData::New();
>> vtkPoints *points = vtkPoints::New();
>> float pts[3]={10,10,10};
>> if((fp=fopen(resfile,"r"))==NULL)
>> { printf("Le fichier FILES ne veut pas s'ouvrire! \n"); exit(1);}
>> while(!feof(fp))
>> { fscanf(fp,"%c %f %f %f",&c,&x,&y,&z);
>> pts[0]=x;pts[1]=y;pts[2]=z;
>> points->InsertPoint(i,pts);
>> i++;
>> }
>> m_polydata->SetPoints(points);
>> m_polydata->Update();
>>
>> vtkPolyDataWriter *writer=vtkPolyDataWriter::New();
>> writer->SetFileName(plyfile);
>> writer->SetInput(m_polydata);
>> writer->Update();
>>
>> /////////test visualisation
>> vtkPolyDataMapper *m_polydataMapper = vtkPolyDataMapper::New();
>> m_polydataMapper->SetInput(m_polydata);
>> // m_polydataMapper->SetScalarRange(0,256);
>> vtkActor *m_Actor = vtkActor::New();
>> m_Actor->SetMapper(m_polydataMapper);
>> //m_Actor->GetProperty()->SetRepresentationToPoints();
>> m_Actor->GetProperty()->SetColor(1, 0, 0);
>> // m_Actor->GetProperty()->SetDiffuseColor(1,1,1);
>> vtkRenderer *m_renderer = vtkRenderer::New();
>> vtkRenderWindow *m_renWin = vtkRenderWindow::New();
>> m_renWin->AddRenderer(m_renderer);
>> vtkRenderWindowInteractor *m_iren = vtkRenderWindowInteractor::New();
>> m_iren->SetRenderWindow(m_renWin);
>> vtkInteractorStyleTrackballCamera *m_style =
>> vtkInteractorStyleTrackballCamera::New();
>> m_iren->SetInteractorStyle(m_style);
>> m_renderer->AddActor(m_Actor);
>> m_renderer->SetBackground(0, 0, 0);
>> m_renWin->SetSize(300,300);
>> m_renWin->Render();
>> m_iren->Start();
>> //Free
>> m_polydata->Delete();
>> m_polydataMapper->Delete();
>> m_Actor->Delete();
>> m_renderer->Delete();
>> m_renWin->Delete();
>> m_iren->Delete();
>>
>
> --
> Amy Squillacote
> Kitware, Inc.
> 28 Corporate Drive
> Clifton Park, NY 12065
> Phone: (518) 371-3971 x106
>
> _______________________________________________
> 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
>
>
--
View this message in context: http://www.nabble.com/rendring-problem-tf3960601.html#a11248264
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list