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

Clinton Stimpson clinton at elemtech.com
Thu Oct 29 12:43:47 EDT 2009


On Thursday 29 October 2009 04:02:58 am Arnaud Devalkeneer wrote:
> 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());

Try swapping the above two calls:
image_view->SetupInteractor(widget.GetRenderWindow()->GetInteractor());
widget.SetRenderWindow(image_view->GetRenderWindow());

Clint

>
>   widget.show();
>
>   app.exec();
>
>   image_view->Delete();
>   return 0;




More information about the vtkusers mailing list