C++ OpenGL rendering, wxPython GUI?

Carl Banks invalidemail at aerojockey.com
Tue Feb 28 06:39:44 EST 2006


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.
>
> After looking around in these groups and others it seems to me that
> most people doing 3D-applications simply opt to use PyOpenGL. Since my
> application uses VBOs, shader programs and similar things this is not
> an option for me.
>
> My rendering engine currently uses GLUT for window handling, but what I
> want to do is to create the canvas in python for use with wxPython and
> then somehow toss it down to C++ for rendering and avoid using GLUT at
> all. I've yet to come across an example of how this could be done.
>
> 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.

You should be able to create and realize the OpenGL canvas (which will
create an OpenGL context), then make the OpenGL calls from C++ without
any worries.  Realizing (i.e., creating the window for) the canvas
would create the OpenGL context, and somewhere along the way the
context gets bound (probably during the canvas's draw callback).

BTW, though you can't use PyOpenGL for the VBO stuff, it might be
useful to install it anyways to do high-level stuff (set up flags,
position the camera, etc.).  Calls from C and PyOpenGL can be freely
mixed.

I've done similar things in GTK on Linux.  I had a gtkglarea canvas,
PyOpenGL, and my own C extension all making OpenGL calls.



Carl Banks




More information about the Python-list mailing list