473,396 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

GUI development with 3D view

Hi,

I'm looking for quite some time now for a gui library for python,
which allows me to display 3D graphics. Main OS is windows, Mac OS X
and Linux would be nice to have. I want to use python 2.5. My first
try was wx + pyOpenGL but there are no working binaries for python
2.5. I simply have to display some dialogs for data input and a 3D
scene with lots of arrows. No fancy mesh and scene handling is needed.

Is there an alternative to wx+pyOpenGL?

regards,
Achim
Dec 10 '07 #1
11 2167
Achim Domma wrote:
Hi,

I'm looking for quite some time now for a gui library for python,
which allows me to display 3D graphics. Main OS is windows, Mac OS X
and Linux would be nice to have. I want to use python 2.5. My first
try was wx + pyOpenGL but there are no working binaries for python
2.5. I simply have to display some dialogs for data input and a 3D
scene with lots of arrows. No fancy mesh and scene handling is needed.

Is there an alternative to wx+pyOpenGL?
The usual suspects - mainly Qt, possibly Tk (not sure if there is a
python-available version of open gl canvasses for Tk)

Diez
Dec 10 '07 #2
Diez B. Roggisch wrote:
Achim Domma wrote:
[snip]
>>
Is there an alternative to wx+pyOpenGL?

The usual suspects - mainly Qt, possibly Tk (not sure if there is a
python-available version of open gl canvasses for Tk)

Diez
togl is a Tk/OpenGL widget that can be used with python as well. I
think it is included in PyOpenGL. It is quite easy to use iirc, but
I've got no idea how it works with windows.
Dec 10 '07 #3
Hi!
no idea how it works with windows.
On XP: fine.
On Vista: very difficult...

@+

MCI
Dec 10 '07 #4
Méta-MCI (MVP) wrote:
>no idea how it works with windows.

On XP: fine.
On Vista: very difficult...
Hello Captain Obvious :-)
Dec 10 '07 #5
On 10 Dez., 15:24, "Méta-MCI \(MVP\)"
<enleverlesX.X...@XmclaveauX.comwrote:
Hi!
no idea how it works with windows.

On XP: fine.
On Vista: very difficult...

@+

MCI
Also with Python 2.5? If PyOpenGL would work with Python 2.5, I could
use wx too. But I could not get it to work with 2.5 on windows.

Achim
Dec 10 '07 #6
Achim Domma wrote:
On 10 Dez., 15:24, "Méta-MCI \(MVP\)"
<enleverlesX.X...@XmclaveauX.comwrote:
>Hi!
no idea how it works with windows.

On XP: fine.
On Vista: very difficult...

@+

MCI

Also with Python 2.5? If PyOpenGL would work with Python 2.5, I could
use wx too. But I could not get it to work with 2.5 on windows.
I was under the impression that PyOpenGL is ctypes-based in the new
versions?

Diez
Dec 10 '07 #7
Diez B. Roggisch wrote:
....
I was under the impression that PyOpenGL is ctypes-based in the new
versions?
It is, but I haven't had the time to do a new release and check it on a
Windows box. There are minor fixes in CVS that *should* IIRC make us
run better on those Windows machines that have problems with the 3.x
alphas so far.

Tempus fugit,
Mike

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

Dec 10 '07 #8
Re!

On Vista, OpenGL depend of (releases of) video-cards.
Some cards don't support OpenGL =problem!
Some cards have native openGL support =good (dream?)
Some cards need update (drivers)

@-salutations

Michel Claveau

Dec 10 '07 #9
On 10 Des, 13:33, Achim Domma <do...@procoders.netwrote:
I'm looking for quite some time now for a gui library for python,
which allows me to display 3D graphics. Main OS is windows, Mac OS X
and Linux would be nice to have. I want to use python 2.5. My first
try was wx + pyOpenGL but there are no working binaries for python
2.5.
Huh? The latest version of PyOpenGL uses ctypes and has no binaries as
it is implemented in pure Python. Personally I use my own ctypes
wrapper for the few OpenGL routines I need. There is a lot of unwanted
overhead in PyOpenGL.

Also consider calling OpenGL from a Pyrex extension. That may save you
some overhead if you make a lot of calls to the OpenGL library. A
remedy for that may be to use display lists, or combine vertex arrays
or vertex buffers with NumPy arrays.
Excerpts from my OpenGL wrapper:

from ctypes import *
import numpy
from threading import Lock
opengl_lock = Lock()
GL = windll.opengl32
GLU = windll.glu32

GL_PROJECTION = 0x1701
GL_MODELVIEW = 0x1700
GL_DEPTH_TEST = 0x0B71
GL_VERTEX_ARRAY = 0x8074
GL_NORMAL_ARRAY = 0x8075

glBegin = GL.glBegin
glBegin.argtypes = (c_int,)
glBegin.restype = None

glEnd = GL.glEnd
glEnd.argtypes = ()
glEnd.restype = None

glVertex3f = GL.glVertex3f
glVertex3f.argtypes = (c_float, c_float, c_float)
glVertex3f.restype = None

gltypemap = {
GL_BYTE : numpy.ctypeslib.ndpointer(dtype = numpy.int8,
flags='aligned,contiguous'),
GL_UNSIGNED_BYTE : numpy.ctypeslib.ndpointer(dtype = numpy.uint8,
flags='aligned,contiguous'),
GL_SHORT : numpy.ctypeslib.ndpointer(dtype = numpy.int16,
flags='aligned,contiguous'),
GL_UNSIGNED_SHORT : numpy.ctypeslib.ndpointer(dtype =
numpy.uint16, flags='aligned,contiguous'),
GL_INT : numpy.ctypeslib.ndpointer(dtype = numpy.int32,
flags='aligned,contiguous'),
GL_UNSIGNED_INT : numpy.ctypeslib.ndpointer(dtype = numpy.uint32,
flags='aligned,contiguous'),
GL_FLOAT : numpy.ctypeslib.ndpointer(dtype = numpy.float32,
flags='aligned,contiguous'),
GL_DOUBLE : numpy.ctypeslib.ndpointer(dtype = numpy.float64,
flags='aligned,contiguous'),
GL_UNSIGNED_BYTE_3_3_2 : numpy.ctypeslib.ndpointer(dtype =
numpy.uint8, flags='aligned,contiguous')
}

def glVertexPointer(size, gltype, stride, array):
opengl_lock.acquire()
glfun = GL.glVertexPointer
glfun.argtypes = (c_int, c_int, c_int, gltypemap[gltype])
glfun.restype = None
glfun(size, gltype, stride, array)
opengl_lock.release()

def glGenBuffersARB(n):
opengl_lock.acquire()
PFNGLGENBUFFERSARBPROC = WINFUNCTYPE(None, c_uint,
gltypemap[GL_UNSIGNED_INT])
wglGetProcAddress = GL.wglGetProcAddress
wglGetProcAddress.argtypes = (c_char_p,)
wglGetProcAddress.restype = PFNGLGENBUFFERSARBPROC
glfun = wglGetProcAddress('glGenBuffersARB')
buffers = numpy.zeros(n, dtype=numpy.uint32)
glfun(n, buffers)
opengl_lock.release()
return buffers
Interfacing Python with OpenGL is not rocket science.



Dec 11 '07 #10
If all you need to do is display a bunch of arrows, as you mention,
the easiest thing to do might be to use Visual Python. It is
extremely easy to use.

gsal
Dec 11 '07 #11
On Dec 11, 1:58 am, gsal <salger...@gmail.comwrote:
If all you need to do is display a bunch of arrows, as you mention,
the easiest thing to do might be to use Visual Python. It is
extremely easy to use.
Another option, if your app is data-driven, is to check out the
Visualization Toolkit (VTK) at http://www.vtk.org. It also has 3D
graphics and a Python interface.

Glenn
Dec 11 '07 #12

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

Similar topics

28
by: Me | last post by:
I would like to redesign my existing site into php using classes. I am not the most experienced developer with PHP, and would like to know if anyone can give me some input on a starting point for a...
1
by: Henry Reardon | last post by:
I have been having problems with the Development Center for several days now. It seemed to be working fine when I initially installed DB2 (LUW) Version 8 (FP7) and upgraded to FP8, except that I...
2
by: SpotNet | last post by:
Hi NewsGroup, Currently constructing a MDI application with tree view functionality. That is to say my application will look something like Windows Explorer with the ability to view data and...
8
by: Jacob Crossley | last post by:
Preface: Not to sound mean or arrogant, but please don't answer this question unless you have a specific and tested answer. I'm saying this only because I posted the same quesion earlier and got...
16
by: Linus | last post by:
Being a ASP developer for a consultant company thinking of starting developing with ASP.NET I have read literally hundreds of web pages and posts in discussion forums on the Internet to get an idea...
31
by: Cy | last post by:
Hi all, I wanted to start a thread that might help many of us. I worked for a company for 12 years, until this past Christmas when they let me go. Getting rid of the higher dollar guys, in...
4
by: Richard Levasseur | last post by:
(Forewarning, most of these problems and solutions come from being the only developer in a 1 server department with no budget, few resources, unresponsive IT, and non-technical managers, so thats...
10
by: Michael B. Trausch | last post by:
Alright, I seem to be at a loss for what I am looking for, and I am not even really all that sure if it is possible or not. I found the 'pdb' debugger, but I was wondering if there was something...
1
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
I did development by using .NET 2003 (enterprise edition) which does not have tree view control for web form, and SQL server 2000 installed on the same machine with server 2000 operating system....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.