我想通過python獲得3D功能並下載pyglet。在通過tutorial的第一個示例時,我收到了一堆我無法辨別的奇怪錯誤。以下是我試圖運行腳本:python pyglet和opengl
import pyglet
win = pyglet.window.Window()
@win.event
def on_draw():
win.clear()
pyglet.app.run()
2以下是我從Python解釋器接收到的輸出後,我輸入我的腳本:
>>> import test as t
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "test.py", line 13, in <module>
pyglet.app.run()
File "/usr/lib/pymodules/python2.7/pyglet/app/__init__.py", line 264, in run
EventLoop().run()
File "/usr/lib/pymodules/python2.7/pyglet/app/xlib.py", line 93, in run
sleep_time = self.idle()
Fihttp://greendalecs.wordpress.com/2012/04/21/3d-programming-in-python-part-1/#commentsle "/usr/lib/pymodules/python2.7/pyglet/app/__init__.py", line 193, in idle
window.dispatch_event('on_draw')
File "/usr/lib/pymodules/python2.7/pyglet/window/__init__.py", line 1219, in dispatch_event
EventDispatcher.dispatch_event(self, *args)
File "/usr/lib/pymodules/python2.7/pyglet/event.py", line 340, in dispatch_event
if handler(*args):
File "test.py", line 13, in on_draw
pyglet.app.run()
NameError: global name 'GL_COlOR_BUFFER_BIT' is not defined
- 我怎樣才能解決這些錯誤?我使用Ubuntu 12.04 LTS和Emacs 24.3。
- 我已經下載了pyglet,通過
apt-get install
,但還有什麼我需要做的?也許我沒有配置驅動程序,或者我需要不同的軟件。
如果您需要更多信息,請告訴我!
我只是做了這個:'pip安裝PyOpenGL PyOpenGL_accelerate',現在一切正常...... – CodeKingPlusPlus