[vtkusers] Visualize vtkPoints?

Ambar C ambarc at gmail.com
Sat Nov 27 04:05:50 EST 2010


Hello, I'm trying to visualize a set of points in a vtkPoints object
with the following code:

	
	vtkPolyData *poly1 = vtkPolyData::New();
	vtkPolyData *poly2 = vtkPolyData::New();
	vtkPolyData *poly3 = vtkPolyData::New();
	vtkPolyData *poly4 = vtkPolyData::New();

	vtkPoints *points1 = vtkPoints::New();


	//Inserting points.

	points1->InsertNextPoint(1, 4, 5);
	points1->InsertNextPoint(-1, 3, 2);
	points1->InsertNextPoint(-4, -4, -4);

	poly1->SetPoints(points1);

        //Starting the visualization
	vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
	mapper->SetInput(poly1);

	vtkActor *actor = vtkActor::New();
	actor->SetMapper(mapper);
	actor->GetProperty()->SetColor(255,0,0);
	
	vtkRenderer *ren = vtkRenderer::New();
	ren->SetBackground( 0.1, 0.2, 0.4 );
	ren->AddActor(actor);

	vtkRenderWindow *renWin = vtkRenderWindow::New();
	renWin->AddRenderer(ren);
	
	vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
	iren->SetRenderWindow(renWin);


However, I just get a blank window. I'm not sure where I'm going
wrong. Any suggestions?

Cheers.



More information about the vtkusers mailing list