C++ OpenGL rendering, wxPython GUI?

T

tobfon

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.

Tobias Forslöw
 
C

Carl Banks

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
 
M

Michael Ekstrand

On 28 Feb 2006 01:14:15 -0800
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
 
J

John M. Gabriele

[snip] 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.

You might look into PyFLTK (which I think was just recently
mentioned on the announce list):

http://pyfltk.sourceforge.net/

I haven't used it. Just something to maybe look into. I think
fltk does indeed have support for OpenGL. And I hear it's a
fast and light toolkit. ;)

---John
 
?

=?iso-8859-1?q?Tobias_Forsl=F6w?=

Thanks for all the quick help! After reading your posts about how the
canvases actually work it was fairly easy to make my C++ code work
within a wxPython frame.

Now I only have to decide If I'm actually going to use wxPython or if
there is a better alternative but there seem to be plenty of threads on
that subject already.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top