如何防止 pyglet 清除屏幕?

发布于 2024-08-10 19:55:27 字数 266 浏览 1 评论 0原文

我想绘制一个场景并依次向其添加线条。但是 pyglet 会在不受控制的情况下不断更新:(,所以我得到的只是闪烁,

from pyglet.gl import *

window=pyglet.window.Window()

def drawline():
    ...

@window.event
def on_draw():
    drawline()

pyglet.app.run()

我应该更改装饰器(如果存在选项)还是什么? 谢谢!

I want to draw a scene and sequentially add lines to it. But pyglet keeps updating without control :( , so all I get is blinks

from pyglet.gl import *

window=pyglet.window.Window()

def drawline():
    ...

@window.event
def on_draw():
    drawline()

pyglet.app.run()

should I change the decorator(if there exist options) or what?
Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞笑我太脆弱 2024-08-17 19:55:27

每次重新绘制窗口时,您都需要绘制线条,因为它们不会被保留。您最好使用批量顶点列表并向其中添加。请参阅此处此处了解详细信息。

You'll need to draw your lines each time the window is redrawn as they won't be retained. You're probably better off using batches of vertex lists and adding to them. See here and here for details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文