On Fri, Jun 14, 2013 at 8:03 PM, Nathaniel Virgo <nathanielvirgo@gmail.com> wrote:
Hi Ian

As far as I can tell, the glX* functions referred to in that link are the platform-specific stuff for X Windows, whereas the CGL* functions used in the code I posted are the equivalent for a Mac. However, the problem is that I can't seem to call any of these platform specific functions from within Python without causing a segmentation fault.

Of course, if you or anyone else has any code for calling glX* functions on linux from PyOpenGL it would really help a lot, because maybe I can modify it to use the CGL* functions that I need to use on OS X.

Kind regards,
Nathaniel
I meant, that link has some of the information to get you started. Getting started with double-buffering instead of tweaking VSync is probably the solution to most problems. Because of the way displays work, a completely rendered graphics frame is much more important than synchronizing display blit to the actual rendering.

Many windowing systems automatically enable VSync initially. SDL (PyGame in Python) is one example. GLUT is not one, as I remember. Ultimately any solution is platform specific--though it may be masked in a platform independent layer. GLUT apparently doesn't provide such a platform independent layer for you, so any solution is going to be platform specific.

But that's already been established. GLUT has other problems. Its callback methods are crude and inflexible. Its support for context creation is lacking. It's built on ancient technology and is semi-proprietary. It supports only one window and has a restricted set of controller inputs and, as you see, poor platform abstraction for some tasks.

I don't know what's wrong with your ctypes code, but I can tell you that there are much better options than GLUT. PyGame, which I mentioned earlier is an excellent choice. It is better than or equal to GLUT in literally every way, including VSync support--which you can toggle when creating a window. I know it's not really what you asked for, but it's my recommendation.

Ian