I've been using PyOpenGL in conjunction with PySide and QML (on Linux).
The idea is to have an OpenGL scene, with a declarative view on top
presenting interface widgets. I describe it a little more here (with a
picture):
http://hgomersall.wordpress.com/2011/03/31/qml_with_opengl_using_python/

I had everything working well with my old laptop (Radeon x1400 graphics
card with the r300g driver, running Ubuntu 10.10). However, in moving to
a new machine (necessitated by the death of the laptop), I've been
experience an interesting (and frustrating) bug, which I've been
attempting to isolate for the last few days. My evidence all seems to
suggest that this is bug only shows with Mesa drivers. I get it using an
Intel GMA X3100, Radeon 4350 using the r600 driver, and also using the
software Mesa driver.

The code that triggers the bug can be found here:
https://github.com/hgomersall/Blog-Code/tree/master/qml_with_simplegl_bugtest

I've attempted to pare the code down to be as simple as possible. The
code is run by calling gl_simple.py. The program paints a red triangle
on a black background with a few transparent QML widgets on top.

In addition to running gl_simple.py, the code can also be entered by
running broken_wrapper.py or hd4350_working_wrapper.py. Inspection of
those files will hopefully convince that the program logic is identical
in all three cases: broken_wrapper.py replicates the main() call in
gl_simple.py and hd_4350_working_wrapper.py does similarly but has a
single (trivial) function redirect.

With python 2.7 we get the following outcomes depending on how the code
is executed:
1) gl_simple.py executed: Everything works as expected on the
desktop ATI HD4350, the laptop Intel GMA X3100 and the software mesa
driver (a red triangle and some sliders).
2) broken_wrapper.py executed: The program hangs with all three. The
process can only be exited with a kill from the command line.
3) hd4350_working_wrapper.py executed: Runs as expected on the desktop
ATI HD4350 machine, but hangs on the laptop and with the software mesa
driver (this I do not understand at all).

With python 2.6, I cannot find any code that works - it always seems to
hang.

In addition to the problems above, the bug (with apparently identical
symptoms) can be triggered as follows:
The GL commands are split between two classes in two different files:
gl_simple.py and renderer_simple.py, containing the Renderer class
(which is called from gl_simple.py). If "from OpenGL import GL" is
included in any file in addition to gl_simple.py, then the program will
hang. The workaround used is to pass GL explicitly to Renderer and to
store that within the class instance. This is how the code is made to
work.

There is a call to import numpy within gl_simple.py. Numpy is *not* used
within my code in gl_simple.py, but if this import is removed then the
program hangs. Numpy has to be imported *before* GL is imported - doing
so after causes the hang.

I've tested the code with PyQt4, and I seem to get mostly the same
symptoms (this is included as a branch on the github repository). The
differences are that the hd4350_working_wrapper.py doesn't work at all
now and neither does the mesa driver (including on gl_simple.py). I
haven't tested this branch with the Intel card.

It very important to me that I get to the bottom of this bug so any
assistance would be *much* appreciated.

Many thanks,

Henry Gomersall



_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside

Reply via email to