473,466 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Python GUI + OpenGL

Hi,

I'm developing a GUI app in Python/C++ to visualize numerical results.
Currently I'm using Python 2.4 with wx and PyOpenGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.

I need a OpenGL context without restrictions and some settings dialogs.
Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
of tools/libs?

regards,
Achim
Mar 2 '07 #1
9 7489
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 PyOpenGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.

I need a OpenGL context without restrictions and some settings dialogs.
Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
of tools/libs?
PyQt, but then there is the licensing question of course.

Diez
Mar 2 '07 #2
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 PyOpenGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.

I need a OpenGL context without restrictions and some settings dialogs.
Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
of tools/libs?

regards,
Achim
PyOpenGL 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
PyOpenGL 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

--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com

Mar 2 '07 #3
On Mar 2, 9:17 am, Achim Domma <d...@procoders.netwrote:
I need a OpenGL context without restrictions and some settings dialogs.
Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
of tools/libs?
You could use pygtk + pygtkglext.

http://pygtk.org/
http://gtkglext.sourceforge.net/

Regards,
Jordan

Mar 2 '07 #4
Dag
On Fri, 02 Mar 2007 18:30:34 +0100, Diez B. Roggisch <de***@nospam.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 PyOpenGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.

I need a OpenGL context without restrictions and some settings dialogs.
Is wx + PyOpenGL the way to go? Or 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
OpenGL?

Dag
Mar 5 '07 #5
You don't necessarily need an OpenGL wrapper like PyOpenGL. If you
only use a handful of OpenGL 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_POINTS = 0x0000
GL_LINES = 0x0001
GL_LINE_LOOP = 0x0002
GL_LINE_STRIP = 0x0003
GL_TRIANGLES = 0x0004
GL_TRIANGLE_STRIP = 0x0005
GL_TRIANGLE_FAN = 0x0006
GL_QUADS = 0x0007
GL_QUAD_STRIP = 0x0008
GL_POLYGON = 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

On Mar 2, 4:17 pm, Achim Domma <d...@procoders.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 PyOpenGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.

I need a OpenGL context without restrictions and some settings dialogs.
Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
of tools/libs?

regards,
Achim

Mar 5 '07 #6
Dag wrote:
On Fri, 02 Mar 2007 18:30:34 +0100, Diez B. Roggisch <de***@nospam.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 PyOpenGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.

I need a OpenGL context without restrictions and some settings dialogs.
Is wx + PyOpenGL the way to go? Or 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
OpenGL?
I didn't say so. I just pointed out an alternative, as the OP 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
OpenGL-programming. After all, that actually is done using PyOpenGL

Diez
Mar 5 '07 #7
On 3/5/07, Diez B. Roggisch <de***@nospam.web.dewrote:
Dag wrote:
On Fri, 02 Mar 2007 18:30:34 +0100, Diez B. Roggisch <de***@nospam.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 PyOpenGLContext, but there
are no windows binaries for Python 2.5 for quite some time now.

I need a OpenGL context without restrictions and some settings dialogs.
Is wx + PyOpenGL the way to go? Or 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
OpenGL?

I didn't say so. I just pointed out an alternative, as the OP had issues
with obtaining binary packages for wx + py2.5
I believe he was having trouble with binary packages for PyOpenGL,
wxPython has 2.5 binaries and has since it was released.

That said, it's my understanding that the most recent version of
PyOpenGL 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 PyOpenGL 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
OpenGL-programming. After all, that actually is done using PyOpenGL
wx and Qt support OpenGL in essentially the same manner. I believe he
took from your earlier post that Qt had its own built in OpenGL
wrapper (and thus didn't rely on PyOpenGL) but to my knowledge that is
not correct.
Diez
--
http://mail.python.org/mailman/listinfo/python-list
Mar 5 '07 #8
On Monday 05 March 2007 18:22, Chris Mellon wrote:
On 3/5/07, Diez B. Roggisch <de***@nospam.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
OpenGL-programming. After all, that actually is done using PyOpenGL

wx and Qt support OpenGL in essentially the same manner. I believe he
took from your earlier post that Qt had its own built in OpenGL
wrapper (and thus didn't rely on PyOpenGL) but to my knowledge that is
not correct.
Yes, you need PyOpenGL (or any other suitable OpenGL wrapper) to use
OpenGL with PyQt. Qt itself doesn't provide its own API for OpenGL; you
just use the implementation available on your system.

It is possible to get OpenGL-rendered 2D graphics without having
PyOpenGL 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 OpenGL library are still
required.

David
Mar 6 '07 #9
>I didn't say so. I just pointed out an alternative, as the OP had issues
>with obtaining binary packages for wx + py2.5

I believe he was having trouble with binary packages for PyOpenGL,
wxPython has 2.5 binaries and has since it was released.

Ah, I didn't read it that way as the OP didn't say exactly _what_ package he
was missing. Obviously if it's PyOpenGL then using Qt won't buy him much...
Diez
Mar 6 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jonathan P. | last post by:
....that would be for desktop-based apps, games, 3d graphics, and multimedia. ....thanks to APIs and bindings like Pygame, PyOpenGL, PyGtk and PyGtkGLExt. A summary of a lengthy post on the...
9
by: max(01)* | last post by:
hi there. i installed python2.3-opengl, then i tried one of those demos: ---- #!/usr/bin/python2.3 # This is statement is required by the build system to query build info if __name__ ==...
4
by: Dave | last post by:
Hi. I am learning PyOpenGL and I am working with a largish fixed scene composed of several thousand GLtriangles. I plan to store the coords and normals in a NumPy array. Is this the fastest...
0
by: Simon Bunker | last post by:
Hi I was wondering if there is a Python module for running GLSL (OpenGL shader language) in OpenGL through Python. I think that Cg is available through PyCg - most likely using PyGame for the...
3
by: jg.campbell.ng | last post by:
I'm beginning learning Python and OpenGL in Python. Python fine. But difficulties with OpenGL; presumably with the installation of OpenGL. OS = Linux FC5. Python program gl_test.py: from...
3
by: morris.slutsky | last post by:
So every now and then I like to mess around with hobby projects - I often end up trying to write an OpenGL video game. My last attempt aborted due to the difficulty of automating game elements and...
852
by: Mark Tarver | last post by:
How do you compare Python to Lisp? What specific advantages do you think that one has over the other? Note I'm not a Python person and I have no axes to grind here. This is just a question for...
1
by: linksterman | last post by:
hey, I was experimenting with pyglet, and was trying out their opengl, but cant figure out how to scale images... #!/usr/bin/python # $Id:$ '''Demonstrates one way of fixing the display...
13
by: Thomas Troeger | last post by:
Hi, Sorry I've posted a similar question some weeks ago, but I got no answers. I want to embed a Python application on a device with limited resources, esp. storage limitations. Is there a way...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.