[vtk-developers] Rendering of vtkPolyData broken on Nvidia systems

Oleg Koren koren at curefab.com
Fri Jun 22 09:00:13 EDT 2012


Looks like VTK cannot render vtkPolyData correctly when Nvidia driver of
version 295.73 or above is installed. If more than one actor is defined, all
but the first one are rendered black.   

Image 1: correct rendering -
http://image-upload.de/image/YsvZ2O/a7a73bbf38.png
Image 2: wrong rendering -
http://image-upload.de/image/2f28ij/b9c5ffb4d5.png

The problem can be reliably reproduced:

1) Install Nvidia driver 295.73 or above (e.g. from CUDA 4.2
http://developer.nvidia.com/cuda-downloads)
2) Compile and run the code snippet (s. further down)

Some more information:

1) Hardware is not the issue. Confirmed on GeForce GTX 460, 550 Ti, 560 Ti,
580 and 680.
2) Driver 286.19 and below works ok.
3) Seems to depend on the number and ordering of actors. Replacing
mapper_1->Modified(); with mapper->Modified(); gives correct results.  
4) Direct rendering with OpenGL works ok, which is strongly suggesting a bug
of VTK.

I would consider this problem a major issue, as it currently doesn't allow
to use VTK on a modern Nvidia system. Happy to offer my help with testing
and fixing it.  

Probably similar to:
http://vtk.1045678.n5.nabble.com/nVidia-driver-problems-td4739635.html


int main(int argc, char** argv[]) {

	vtkRenderer* renderer = vtkRenderer::New();
	vtkRenderWindow* renderWindow = vtkRenderWindow::New();
	renderWindow->AddRenderer(renderer);

	double origin[3] = {0.0, 0.0, 0.0};
	double point0[3] = {1.0, 0.0, 0.0};
	double point1[3] = {1.0, 1.0, 0.0};
	double point2[3] = {0.0, 1.0, 0.0};
	double point3[3] = {0.0, 0.0, 0.0};

	double origin_1[3] = {0.0, 0.0, 0.0};
	double point0_1[3] = {0.0, 1.0, 0.0};
	double point1_1[3] = {-1.0, 1.0, 0.0};
	double point2_1[3] = {-1.0, 0.0, 0.0};
	double point3_1[3] = {0.0, 0.0, 0.0};

	vtkPoints* points = vtkPoints::New();
	points->InsertNextPoint(origin);
	points->InsertNextPoint(point0);
	points->InsertNextPoint(point1);
	points->InsertNextPoint(point2);
	points->InsertNextPoint(point3);

	vtkPoints* points_1 = vtkPoints::New();
	points_1->InsertNextPoint(origin_1);
	points_1->InsertNextPoint(point0_1);
	points_1->InsertNextPoint(point1_1);
	points_1->InsertNextPoint(point2_1);
	points_1->InsertNextPoint(point3_1);

	vtkPolyLine* line = vtkPolyLine::New();
	line->GetPointIds()->SetNumberOfIds(5);

	vtkPolyLine* line_1 = vtkPolyLine::New();
	line_1->GetPointIds()->SetNumberOfIds(5);

	for(unsigned int i = 0; i< 5; i++) {
		line->GetPointIds()->SetId(i, i);
		line_1->GetPointIds()->SetId(i, i);
	}

	vtkCellArray* cellArray = vtkCellArray::New();
	cellArray->InsertNextCell(line);

	vtkCellArray* cellArray_1 = vtkCellArray::New();
	cellArray_1->InsertNextCell(line_1);

	vtkPolyData* polyData = vtkPolyData::New();
	polyData->SetPoints(points);
	polyData->SetLines(cellArray);

	vtkPolyData* polyData_1 = vtkPolyData::New();
	polyData_1->SetPoints(points_1);
	polyData_1->SetLines(cellArray_1);

	vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
	mapper->SetInput(polyData);
	
	vtkActor* actor = vtkActor::New();
	actor->SetMapper(mapper);
	actor->GetProperty()->SetColor(255,0,0);

	vtkPolyDataMapper* mapper_1 = vtkPolyDataMapper::New();
	mapper_1->SetInput(polyData_1);
	
	vtkActor* actor_1 = vtkActor::New();
	actor_1->SetMapper(mapper_1);
	actor_1->GetProperty()->SetColor(255,255,0);

	renderer->AddActor(actor);
	renderer->AddActor(actor_1);

	while(true) {	
		mapper_1->Modified();
		renderWindow->Render();
	}
	
	return 0;
}


--
View this message in context: http://vtk.1045678.n5.nabble.com/Rendering-of-vtkPolyData-broken-on-Nvidia-systems-tp5714114.html
Sent from the VTK - Dev mailing list archive at Nabble.com.



More information about the vtk-developers mailing list