简体   繁体   中英

pygame OpenGL windows not refreshing on Mac OS X 10.6, Python 2.7

I posted this on the pygame mailing list but maybe someone here will have an answer. I can't be sure whether it's a pygame problem or an SDL problem, really.

Essentially, I have some code that uses PyOpenGL and pygame to render rudimentary animations. It works fine under Linux but for some reason, the pygame windows on my Mac don't refresh unless I click outside the window to "unfocus", at which point they refresh once.

To install SDL and pygame I followed the instructions here . I should note that

  • 2D pygame examples such as pygame.examples.aliens work fine, while 3D ones such as pygame.examples.glcube exhibit the same problem as my own code.
  • PyOpenGL demos work fine, so I'm assuming the problem isn't there.
  • I also see this printed to the console:

     2010-11-12 00:31:51.328 python[75402:903] *** __NSAutoreleaseNoPool(): Object 0x101da6570 of class NSCFData autoreleased with no pool in place - just leaking 

    Anyone know what that means?

事实证明,当我Ctrl + C一个基于pygame的应用程序时,某种OS X驱动程序故障会导致此问题,唯一的解决方法是重新启动。

I am afraid its not a OpenGL problem. I had refresh problem in both windows 7 and MACOSX 10.4.11 . For a strange reason no refresh problem on Linux.

What I did to solve this issue was to detect the "unfocus" event as the window had refresh problem only when it was unfocused and a window passed in front of it. As soon I detected the "unfocus" and / or "focus" even I issued a redraw of the whole window.

By the way I used none of the OpenGL binding or techniques, just standard pygame functions in particular the update function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM