[PyOpenGL-Users] PyOpenGL/PySide QML interaction bug
Brought to you by:
mcfletch
|
From: Henry G. <he...@ca...> - 2011-05-09 15:35:24
|
I've been using PyOpenGL in conjunction with PySide (the python Qt bindings) and QML (Qt's new declarative language). 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 r300 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 bug, the source of which I am not sure about. 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. In its checked in state, the code will function using the workaround described below, but it is simple to trigger the bug. The program paints a red triangle on a black background with a few transparent QML widgets on top. Here is the problem: 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 and needs to be killed. 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. In addition, 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. As mentioned, the bug was triggered by moving to a new machine. This is running Ubuntu 11.11 with a Radeon 4000 series card and the r600 driver. The same problem occurred on a laptop running 11.11 and using an Intel GMA X3100 graphics card. Is this a bug with primarily PyOpenGL or should I be getting on to PySide? Clearly PyOpenGL should handle imports and dependencies without breakages. Thanks, Henry Gomersall |