问题描述
我的机器显然不会在pyglet中绘制顶点列表。下面的代码在窗口的不同位置呈现两个相同的形状,一个使用顶点列表,另一个使用直线 draw()
。
import pyglet
$
import pyglet
window = pyglet.window.Window()
w,h = window.get_size()
vl = pyglet.graphics.vertex_list(4,
('v2i',(100, 0,100,h,200,h,200,0)),
('c3B',(255,255,255,255,0,0,
0,255,0,0,0,255)))
@ window.event
def on_draw():
window.clear()
vl.draw(pyglet.gl.GL_QUADS)
pyglet.graphics。 draw(4,pyglet.gl.GL_QUADS,
('v2i',(300,0,300,h,400,h,400,0)),
('c3B',(255,255,255, 255,0,0,
0,255,0,0,0,255)))
pyglet.app.run()
这是Ubuntu Lucid中的pyglet 1.1.2,使用带有最新Catalyst 12.1驱动程序的AMD Radeon HD 6450卡。我想这一定与驱动程序等有关,因为该代码三年前在多块NVIDIA卡上起作用,并且几乎直接来自pyglet文档。有人知道我需要使用哪种设置,或者某个特定的驱动程序版本正确吗?
解决方案我似乎有相同的想法在带有Radeon HD 4870的Windows 7上运行Catalyst 12.2时出现问题。我从较旧的Geforce 8800 GTX移至此卡后,我的一些较早的代码也部分停止了工作,特别是fps_counter和标签绘图仍然有效,绘制了一批t。
在我将视频驱动程序降级为Catalyst 11.5之后,问题就消失了(包括上面的代码段和我的早期代码)。
更高版本的Catalyst可能会起作用。我首先尝试了此方法,因为它在此处可以正常工作:
更新:经过测试的Catalyst 11.12(最新的11 .x版本,视频驱动程序版本为8.920.0.0000),问题又回来了。
更新2:之后再进行一些测试,结果似乎是这样Catalyst 11.9(视频驱动程序8.892.0.0000)开始出现问题。 Catalyst 11.8(视频驱动程序8.881.0.0000)按预期工作。
一种解决方法是改用 v2f
。
最新更新:这个问题似乎已由Catalyst 12.4(视频驱动程序8.961.0.0)解决。
My machine apparently won't draw vertex lists in pyglet. The following code renders two identical shapes at different positions in the window, one using a vertex list and the other using a straight draw()
. The one that's drawn directly renders fine, while the vertex list doesn't render at all.
import pyglet
window = pyglet.window.Window()
w, h = window.get_size()
vl = pyglet.graphics.vertex_list( 4,
('v2i', (100,0, 100,h, 200,h, 200,0)),
('c3B', (255,255,255, 255,0,0,
0,255,0, 0,0,255)) )
@window.event
def on_draw():
window.clear()
vl.draw( pyglet.gl.GL_QUADS )
pyglet.graphics.draw( 4, pyglet.gl.GL_QUADS,
('v2i', (300,0, 300,h, 400,h, 400,0)),
('c3B', (255,255,255, 255,0,0,
0,255,0, 0,0,255)) )
pyglet.app.run()
This is pyglet 1.1.2 in Ubuntu Lucid, using an AMD Radeon HD 6450 card with the newest Catalyst 12.1 driver. I imagine it must be something to do with the drivers, etc., because this code worked three years ago on several NVIDIA cards, and it's almost direct from the pyglet documentation. Anybody know what setting I need to futz with, or if a particular driver version works right?
解决方案 I seem to have the same problem running Catalyst 12.2 on Windows 7 with a Radeon HD 4870. Some earlier code of mine stopped partially working as well after I moved to this card from my older Geforce 8800 GTX, specifically the fps_counter and label drawing still worked, drawing a batch didn't.
After I downgraded the video driver to Catalyst 11.5 the problems went away (both with your snippet above and with my earlier code).
Later versions of Catalyst might work. I tried this one first because it is mentioned as working somewhat properly overhere: http://groups.google.com/group/pyglet-users/msg/ae317c37ce54c107
Update: Tested Catalyst 11.12 (the latest 11.x release, video driver version 8.920.0.0000) and the problem has returned.
Update 2: Some more testing later, it appears this issue started occuring with Catalyst 11.9 (video driver 8.892.0.0000). Catalyst 11.8 (video driver 8.881.0.0000) worked as expected.
A work-around is to use v2f
instead of v2i
as per this comment on the pyglet issue tracker.
Last update: This problem seems to be fixed with Catalyst 12.4 (video driver 8.961.0.0).
这篇关于pyglet顶点列表未呈现(AMD驱动程序?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!