C++ OpenGL rendering, wxPython GUI?

Michael Ekstrand michael at elehack.net
Tue Feb 28 08:41:31 EST 2006


On 28 Feb 2006 01:14:15 -0800
tobfon at gmail.com wrote:
> I'm creating a scientific visualization application with rather high
> demands on performance. I've created a nice rendering engine for it in
> C++/OpenGL and a python interface to the rendering engine. Now I'm
> looking to build a GUI in python with the rendering engine as an
> integrated window. I will most likely use wxPython for the GUI and I
> know it has support for adding an OpenGL canvas.

> Maybe including wxWidgets in the C++ program and just using the
> wxPython-created canvas ID there will somehow be possible? I'll look
> into that but any help or ideas are most welcome.

I banged my head on this for quite a while trying to integrate
OpenInventor and wxPython (and later PyGTKGLext). Basically, the OpenGL
callers don't need to know what the current canvas is. You tell the
canvas to activate itself, it tells OpenGL "hey, I'm the current canvas
now". Then OpenGL commands draw themselves on that canvas. It's really
much simpler than I initially thought. You just have to make sure that
there's a Python function somewhere in your begin-rendering sequence
that activates the canvas before OpenGL calls begin.

- Michael

-- 
mouse, n: a device for pointing at the xterm in which you want to type.
                -- Fortune



More information about the Python-list mailing list