Re: [PyOpenGL-Users] Glut close function
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@vr...> - 2009-06-06 22:38:14
|
Gijs wrote: > Hello List, > > I tried to bind an exit-function with Glut, but the function you > normally use to bind your exit-function with, glutCloseFunc, does not > exist in Mac OS X. It's called glutWMCloseFunc in Mac OS X. Now this is > not much of a problem, but when I try to use glutCloseFunc, it gives me > the following traceback: > Traceback (most recent call last): > File "./runtests.py", line 107, in <module> > glutCloseFunc(exitProgram) > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/OpenGL/GLUT/special.py", > line 131, in __call__ > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/OpenGL/GLUT/special.py", > line 100, in failFunction > OpenGL.error.NullFunctionError: Undefined GLUT callback function Close, > check for bool(glutCloseFunc) before calling > > Kind of obvious of course, but I wanted to know if there is a normal way > to check if this function really exists. I could check for the platform > I'm running the program in, but to me it seems a better solution to > check for the existence of this function. Even neater would be that > PyOpenGL binds glutWMCloseFunc to glutCloseFunc when ran in Mac OS X. > That would at least keep the Glut/OpenGL code platform independent. > We do something similar for Win32. Unlike all other platform-specific stuff, this is done in the GLUT package itself, where we substitute a call that does the correct Win32-ish thing when creating windows so that they will be properly closed down. If you would like to provide an equivalent for OS X, I'm willing to include it. The GLUT/special.py module is where it would likely go. Have fun, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |