embedding opengl in wxpython window [Re: Advice needed: large OpenGL + Widgets Project for Molecular]

Mike C. Fletcher mcfletch at rogers.com
Tue Mar 16 10:21:30 EST 2004


DH wrote:
...

> The problem I have though is - can you have an opengl canvas in the 
> same window with other wxpython controls.  I've done this in java, 
> basic and C, but the wxpython demo only showed opengl animations 
> running in their own window.  This is my problem with vpython and sdl 
> too.  I want something that can be embedded in a tk/wx/qt/gtk window 
> with other controls, even other opengl canvases.  At the C level, it's 
> just a matter of clipping the drawing and switching the current 
> drawing context.

This works fine. See the browser sub-package of OpenGLContext for a 
demo.  See also much simpler demo in 
OpenGLContext/tests/wx_with_controls.py, which just puts a button and a 
wxPython Context (derived from wxGLCanvas) on a window and uses the 
button to start/stop the animation.  PyOpenGL and wxPython are both just 
thin wrappers around their respective C/C++ libraries, so most of the 
functionality in the lower levels is available.

> >>   Disadvantages: The OpenGL install still crashed under Windows. A
> >>   widget set that not many people use? Also requires the most amount
> >>   of code rewrite, although if it's the best option it isn't a
> >>   problem.
>
> Yeah, it doesn't work on Windows for me either with python 2.3.  It 
> used to work with python 2.2.  Now it complains about not finding glut.

If you encounter a bug like this, please submit a bug-report to the 
project so that it can be fixed.  As a quick check though, you did 
install the GLUT binary package in your system32 directory, right?  
PyOpenGL doesn't include the GLUT library itself, only a binding for it.

Have fun,
Mike

_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/






More information about the Python-list mailing list