As the name says. I would like to enable vertical sync in PyOpenGL, but how can I do this? A sufficiently comprehensive search on the Internet did not cause anything, but maybe someone has a smart solution? I am in OS X, and I do not mind which package is used to create the window and the application loop. However, I would prefer to avoid developing a full-blown Cocoa application for the reasons discussed below.
I studied the use of pyglet, not PyOpenGL, but the only version of pyglet that runs on a 64-bit OS is the alpha release, which is almost a year ago, so I don't want to use it because I'm afraid it might be refused. This is a shame because it really looked much better than PyOpenGL.
On this page I found the following code. The page talks about this for pygame, but it looks like it should work for Glut as well. However, when I run it (after creating the context), it just causes a segmentation error. If anyone can understand why this is happening, it would be great because something like this is what I'm looking for.
import sys def enable_vsync(): if sys.platform != 'darwin': return try: import ctypes import ctypes.util ogl = ctypes.cdll.LoadLibrary(ctypes.util.find_library("OpenGL"))
I could try pygame instead and see if this code works with this, but I found several reports on the Internet that this code also works with pygame, so I assume this is what worked before, but now it doesnβt .
Finally, I know that the solution that will work is to create a Cocoa application with PyObjC. However, there is a rather large learning curve, and I get something that is even close to cross-platform. This code is for my personal use only, but I am very interested in maximizing my likelihood of getting it to work again if I return to it in a few years on another machine. For these reasons, I really don't think that creating a Cocoa application is what I want to get to.