为什么我的pyglet顶点列表和批处理在Windows上会非常慢?

时间:2022-09-10 17:24:16

I'm writing opengl code in python using the library pyglet. When I draw to the screen using pyglet.graphics.vertex_list or pyglet.graphics.batch objects, they are very slow (~0.1 fps) compared to plain old pyglet.graphics.draw() or just glVertex() calls, which are about 40fps for the same geometry. In Linux the vertex_list is about the same speed as glVertex, which is disappointing, and batch methods are about twice as fast, which is a little better but not as much gain as I was hoping for.

我正在使用库pyglet在python中编写opengl代码。当我使用pyglet.graphics.vertex_list或pyglet.graphics.batch对象绘制到屏幕时,与普通的旧pyglet.graphics.draw()或只是glVertex()调用相比,它们非常慢(~0.1 fps) 40fps用于相同的几何形状。在Linux中,vertex_list与glVertex的速度大致相同,这是令人失望的,批处理方法的速度大约是其两倍,这有点好,但没有我希望的那么多。

2 个解决方案

#1


4  

Don't forget to invoke your pyglet scripts with 'python -O myscript.py', the '-O' flag can make a huge performance difference.

不要忘记用'python -O myscript.py'调用你的pyglet脚本,' - O'标志可以产生巨大的性能差异。

See pyglet docs here and here.

请参阅此处和此处的pyglet文档。

#2


1  

I don't know personally, but I noticed that you haven't posted to the pyglet mailing list about this. More Pyglet users, as well as the primary developer, read that list.

我个人不认识,但我注意到你还没有发布到pyglet邮件列表中。更多Pyglet用户以及主要开发人员阅读该列表。

#1


4  

Don't forget to invoke your pyglet scripts with 'python -O myscript.py', the '-O' flag can make a huge performance difference.

不要忘记用'python -O myscript.py'调用你的pyglet脚本,' - O'标志可以产生巨大的性能差异。

See pyglet docs here and here.

请参阅此处和此处的pyglet文档。

#2


1  

I don't know personally, but I noticed that you haven't posted to the pyglet mailing list about this. More Pyglet users, as well as the primary developer, read that list.

我个人不认识,但我注意到你还没有发布到pyglet邮件列表中。更多Pyglet用户以及主要开发人员阅读该列表。