Python GUI + OpenGL
9 answers - 412 bytes -

Hi,
I'm developing a GUI app in Python/C++ to visualize numerical results.
Currently I'm using Python 2.4 with wx and PGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.
I need a GL context without restrictions and some settings dialogs.
Is wx + PGL the way to go? could somebody recommend a better set
of tools/libs?
regards,
Achim
No.1 | | 490 bytes |
| 
Achim Domma wrote:
Hi,
I'm developing a GUI app in Python/C++ to visualize numerical results.
Currently I'm using Python 2.4 with wx and PGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.
I need a GL context without restrictions and some settings dialogs.
Is wx + PGL the way to go? could somebody recommend a better set
of tools/libs?
PyQt, but then there is the licensing question of course.
Diez
No.2 | | 893 bytes |
| 
Achim Domma wrote:
Hi,
I'm developing a GUI app in Python/C++ to visualize numerical results.
Currently I'm using Python 2.4 with wx and PGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.
I need a GL context without restrictions and some settings dialogs.
Is wx + PGL the way to go? could somebody recommend a better set
of tools/libs?
regards,
Achim
PGL 3.x (currently in alpha state, but reasonably usable) works on
Python 2.5, there are no binaries because the system no longer requires
binary versions. Install the setuptools package, then run easy_install
PGL and the egg file should be downloaded and installed to your
machine. The current version doesn't package GLE along with the code,
however, so you'll have to find a DLL for that if you need it.
HTH,
Mike
No.3 | | 314 bytes |
| 
Mar 2, 9:17 am, Achim Domma <d (AT) procoders (DOT) netwrote:
I need a GL context without restrictions and some settings dialogs.
Is wx + PGL the way to go? could somebody recommend a better set
of tools/libs?
You could use pygtk + pygtkglext.
http://pygtk.org/
Regards,
Jordan
No.4 | | 983 bytes |
| 
Fri, 02 Mar 2007 18:30:34 +0100, Diez B. Roggisch <deets (AT) nospam (DOT) web.dewrote:
Achim Domma wrote:
>
>Hi,
>
>I'm developing a GUI app in Python/C++ to visualize numerical results.
>Currently I'm using Python 2.4 with wx and PGLContext, but there
>are no windows binaries for Python 2.5 for quite some time now.
>
>I need a GL context without restrictions and some settings dialogs.
>Is wx + PGL the way to go? could somebody recommend a better set
>of tools/libs?
>
PyQt, but then there is the licensing question of course.
I'm facing a similar problem. Would you care to explain why PyQt is
better in this particular case. I've used both PyQt and wx for 'normal'
GUI programming (but I'm more familiar with wx) so I know about their
difference in general. But why is PyQt better than wx for working with
GL?
Dag
No.5 | | 1797 bytes |
| 
You don't necessarily need an GL wrapper like PGL. If you
only use a handful of GL functions, it would be relatively
straight-forward to make your own, using ctypes.
Here is what it would look like:
from ctypes import cdll, windll, c_double, c_float, c_int
GL_PINTS = 0x0000
GL_LINES = 0x0001
GL_LINE_LP = 0x0002
GL_LINE_STRIP = 0x0003
GL_TRIANGLES = 0x0004
GL_TRIANGLE_STRIP = 0x0005
GL_TRIANGLE_FAN = 0x0006
GL_QUADS = 0x0007
GL_QUAD_STRIP = 0x0008
GL_PLYGN = 0x0009
gl = windll.LoadLibrary("opengl32")
glEnd = gl.glEnd
glEnd.restype = None
glBegin = gl.glBegin
glBegin.argtypes = [c_int]
glBegin.restype = None
glVertex2f = gl.glVertex2d
glVertex2f.argtypes = [c_double, c_double]
glVertex2f.restype = None
glColor3f = gl.glColor3d
glColor3f.argtypes = [c_double, c_double, c_double]
glColor3f.restype = None
glClear = gl.glClear
glClear.argtypes = [c_int]
glClear.restype = None
glClearColor = gl.glClearColor
glClearColor.argtypes = [c_double, c_double, c_double, c_double]
glClearColor.restype = None
glViewport = gl.glViewport
glViewport.argtypes = [c_int, c_int, c_int, c_int]
glViewport.restype = None
[etc]
Regards,
Laurent
Mar 2, 4:17 pm, Achim Domma <d (AT) procoders (DOT) netwrote:
Hi,
I'm developing a GUI app in Python/C++ to visualize numerical results.
Currently I'm using Python 2.4 with wx and PGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.
I need a GL context without restrictions and some settings dialogs.
Is wx + PGL the way to go? could somebody recommend a better set
of tools/libs?
regards,
Achim
No.6 | | 1420 bytes |
| 
Dag wrote:
Fri, 02 Mar 2007 18:30:34 +0100, Diez B. Roggisch <deets (AT) nospam (DOT) web.de>
wrote:
>Achim Domma wrote:
>>
Hi,
I'm developing a GUI app in Python/C++ to visualize numerical results.
Currently I'm using Python 2.4 with wx and PGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.
I need a GL context without restrictions and some settings dialogs.
Is wx + PGL the way to go? could somebody recommend a better set
of tools/libs?
>>
>PyQt, but then there is the licensing question of course.
I'm facing a similar problem. Would you care to explain why PyQt is
better in this particular case. I've used both PyQt and wx for 'normal'
GUI programming (but I'm more familiar with wx) so I know about their
difference in general. But why is PyQt better than wx for working with
GL?
I didn't say so. I just pointed out an alternative, as the P had issues
with obtaining binary packages for wx + py2.5
Beside that, I do love the Qt library and would always use it in preference
to wx, but this is a general thing and by no means tied to the
GL-programming. After all, that actually is done using PGL
Diez
No.7 | | 2279 bytes |
| 
3/5/07, Diez B. Roggisch <deets (AT) nospam (DOT) web.dewrote:
Dag wrote:
Fri, 02 Mar 2007 18:30:34 +0100, Diez B. Roggisch <deets (AT) nospam (DOT) web.de>
wrote:
>Achim Domma wrote:
>>
Hi,
I'm developing a GUI app in Python/C++ to visualize numerical results.
Currently I'm using Python 2.4 with wx and PGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.
I need a GL context without restrictions and some settings dialogs.
Is wx + PGL the way to go? could somebody recommend a better set
of tools/libs?
>>
>PyQt, but then there is the licensing question of course.
>
I'm facing a similar problem. Would you care to explain why PyQt is
better in this particular case. I've used both PyQt and wx for 'normal'
GUI programming (but I'm more familiar with wx) so I know about their
difference in general. But why is PyQt better than wx for working with
GL?
I didn't say so. I just pointed out an alternative, as the P had issues
with obtaining binary packages for wx + py2.5
I believe he was having trouble with binary packages for PGL,
wxPython has 2.5 binaries and has since it was released.
That said, it's my understanding that the most recent version of
PGL uses ctypes and no longer requires a windows binary, which is
why they are not provided.
Also, if you're writing a C++/Python app on Windows then you must have
the correct environment to build Python extensions, so even if my
understanding is incorrect, you should be able to build PGL via
distutils with minimal if any trouble.
Beside that, I do love the Qt library and would always use it in preference
to wx, but this is a general thing and by no means tied to the
GL-programming. After all, that actually is done using PGL
wx and Qt support GL in essentially the same manner. I believe he
took from your earlier post that Qt had its own built in GL
wrapper (and thus didn't rely on PGL) but to my knowledge that is
not correct.
Diez
No.8 | | 1089 bytes |
| 
Monday 05 March 2007 18:22, Chris Mellon wrote:
3/5/07, Diez B. Roggisch <deets (AT) nospam (DOT) web.dewrote:
>Beside that, I do love the Qt library and would always use it in
>preference to wx, but this is a general thing and by no means tied to the
>GL-programming. After all, that actually is done using PGL
wx and Qt support GL in essentially the same manner. I believe he
took from your earlier post that Qt had its own built in GL
wrapper (and thus didn't rely on PGL) but to my knowledge that is
not correct.
Yes, you need PGL (or any other suitable GL wrapper) to use
GL with PyQt. Qt itself doesn't provide its own API for GL; you
just use the implementation available on your system.
It is possible to get GL-rendered 2D graphics without having
PGL installed; you just paint on a QGLWidget in the usual way.
However, I suspect that the original poster wanted to render 3D
graphics, so Python bindings to the system's GL library are still
required.
David
No.9 | | 503 bytes |
| 
>I didn't say so. I just pointed out an alternative, as the P had issues
>with obtaining binary packages for wx + py2.5
>>
I believe he was having trouble with binary packages for PGL,
wxPython has 2.5 binaries and has since it was released.
Ah, I didn't read it that way as the P didn't say exactly _what_ package he
was missing. if it's PGL then using Qt won't buy him much
Diez