[vtkusers] QVTKWidget + vtkImageViewer2 : X Errors from x11_setup_window()

Arnaud Devalkeneer adevalkeneer at gmail.com
Thu Oct 29 06:02:58 EDT 2009


Hi everybody,

I am trying to test a simple program that show image slice in a qvtkWidget,
with X11 and OpenGL.
But I get some errors from X during the XCreateWindow call
(QVTKWidget::x11_setup_window()).
I also remarked that it does not crash in case of vtkImageViewer instead of
vtkImageViewer2.

In case of vtkImageViewer2 :

X Error: BadColor (invalid Colormap parameter) 12
  Major opcode: 1 (X_CreateWindow)
  Resource id:  0x2400001
X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 3 (X_GetWindowAttributes)
  Resource id:  0x1e00009

Then the application crashes...

Do you have any workaround / bug fix for this problem?
I check the vtk mantis database but do not manage to find any ticket about
this problem.

My environment is :
- QT 4.5
- VTK 5.4 compiled in DEBUG mode
- nvidia opengl driver 180-44
- ubuntu 9.04

Here is the simple test source code :

 typedef itk::ImageToVTKImageFilter<ItkImgT> ConnectorT;

 QApplication app(argc, argv);

  QVTKWidget widget;
  widget.resize(800,800);
#if QT_VERSION < 0x040000
  app.setMainWidget(&widget);
#endif

  ConnectorT::Pointer connector = ConnectorT::New();
  connector->SetInput(itkImg);
  connector->Update();

  vtkImageViewer2* image_view = vtkImageViewer2::New();
  image_view->SetInput(connector->GetOutput());
  image_view->SetSlice(10);
  image_view->SetColorLevel (128);
  image_view->SetColorWindow (255);

  widget.SetRenderWindow(image_view->GetRenderWindow());
  image_view->SetupInteractor(widget.GetRenderWindow()->GetInteractor());

  widget.show();

  app.exec();

  image_view->Delete();
  return 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091029/0920dfb7/attachment.htm>


More information about the vtkusers mailing list