本文介绍了如何避免在Linux / X11上使用pygame的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在玩pygame(在Debian / Lenny上)。
它似乎很好地工作,除了恼人的撕裂(全屏或窗口模式)。



我使用默认的SDL X11驱动程序。谷歌搜索表明,这是SDL的一个已知问题,即X11不提供vsync工具(即使用 FULLSCREEN | DOUBLEBUF | HWSURFACE 标志创建的显示),我应该使用dga

然而,运行

  SDL_VIDEODRIVER = dga。 /mygame.py 

在pygame初始化中抛出

  pygame.error:没有可用的视频设备

(尽管 xdpyinfo 显示了一个XFree86-DGA扩展)



所以:获得免撕离术的技巧是什么翻转?或者通过获得这个dga的东西工作或其他机制?

解决方案

那么我最终的解决方案是切换到,它似乎支持比Pygame更好的OpenGL,并且没有任何闪烁问题。


I've been playing with pygame (on Debian/Lenny).It seems to work nicely, except for annoying tearing of blits (fullscreen or windowed mode).

I'm using the default SDL X11 driver. Googling suggests that it's a known issue with SDL that X11 provides no vsync facility (even with a display created with FULLSCREEN|DOUBLEBUF|HWSURFACE flags), and I should use the "dga" driver instead.

However, running

SDL_VIDEODRIVER=dga ./mygame.py

throws in pygame initialisation with

pygame.error: No available video device

(despite xdpyinfo showing an XFree86-DGA extension present).

So: what's the trick to getting tear-free vsynced flips ? Either by getting this dga thing working or some other mechanism ?

解决方案

Well my eventual solution was to switch to Pyglet, which seems to support OpenGL much better than Pygame, and doesn't have any flicker problems.

这篇关于如何避免在Linux / X11上使用pygame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 09:48