[vtk-developers] Linux/OpenGL Error caused by vtkRenderWindowInteractor

Andrew Maclean andrew.amaclean at gmail.com
Mon May 26 01:47:16 EDT 2014


This error does not appear in Windows 8.1 or Mac OSX Mavericks.

Please refer to Mobius.zip.

In Ubuntu Linux 14.4 the following error is triggered when MobiusExample.py
is executed or when Mobius.cxx is built and run.

vtkpython MobiusExample.py
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  11 (X_GLXSwapBuffers)
  Serial number of failed request:  82
  Current serial number in output stream:  82

It is related to the fact that the vtkRenderWindowInteractor is declared
after all the rendering work is done and placed in the render window.
If you do the usual:
    ren = vtk.vtkRenderer()
    renWin = vtk.vtkRenderWindow()
    iren = vtk.vtkRenderWindowInteractor()
    renWin.AddRenderer(ren)
    iren.SetRenderWindow(renWin)

and not return a renWin then everything works normally.
Look at MobiusExampleOK.py for this implementation.
In MobiusExampleOK.py, if you return a renWin then you need to click on the
window to trigger the zoom and resize.

This reproducible in C++ (see Mobius.cxx) so the question really is:
"Why is vtkRenderWindowInteractor() positionally important in Linux?"

A quick check of the tests in VTK reveals that generally the "holy trinity"
of:
    ren = vtk.vtkRenderer()
    renWin = vtk.vtkRenderWindow()
    iren = vtk.vtkRenderWindowInteractor()
    renWin.AddRenderer(ren)
    iren.SetRenderWindow(renWin)
is implemented in both Python and C++ and TCL.
So this OpenGL error would never be triggered.

In the zipped up file there is also a C++ example that you can play with.
Move line 83-84 to 63 and line 86 to 65 will allow this to run without
crashing in Linux.
However you will still need to click on the window to trigger the zoom.

In case anyone is wondering, the reason for writing the python code like
this was to save an image when called from another python script but when
run directly allow the user to interact with it. The other python script
does not need the interactor, it is just running the code and saving the
resultant image to a file.

I have tested it in Linux 14.4 running natively and as a virtual machine.
Also I used a version of VTK (in the git repository) a few weeks old and
then checked out the most recent version from the git repository after the
changes to the DataModel and ExecutionModel. I am using NVidia drivers in
both machines.
glxinfo | grep error
returns nothing.

Is vtkRenderWindowInteractor trying to reinitialize the GLX module after it
has already been initialised by vtkRenderWindow? I'm guessing here. It
still doesn't explain why the code works in Windows and Macs.

Regards
   Andrew

-- 
___________________________________________
Andrew J. P. Maclean

___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtk-developers/attachments/20140526/60d84dc4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mobius.zip
Type: application/zip
Size: 3111 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtk-developers/attachments/20140526/60d84dc4/attachment.zip>


More information about the vtk-developers mailing list