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 windo开发者_运维知识库w 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 aspygame.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?
It turns out some sort of OS X driver glitch causes this when I Ctrl+C a pygame-based application, and the only fix is to reboot.
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.
精彩评论