Why is pyglet so slow compared to pygame?

ⅰ亾dé卋堺 提交于 2019-12-03 08:10:59

The bottleneck is in pyglet sprite rotation. If you comment the 'self.rotation' line in Square update() method, your fps will almost double.

Pyglet images (and sprites) can be rotated around an arbitrary anchor. If you look at pyglet/sprite.py, you will see that this is done using the Python math module, which is why it's rather slow. It would seem there is room for optimiziation here, by rotating sprites using OpenGL glRotate or even a vertex shader.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!