问题
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?
回答1:
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).
来源:https://stackoverflow.com/questions/9369357/pyglet-vertex-list-not-rendered-amd-driver