简体   繁体   English

python pyglet和opengl

[英]python pyglet and opengl

I am trying to get 3D capabilities through python and have download pyglet. 我试图通过python获得3D功能并下载pyglet。 While going through the first example in this tutorial I got a bunch of strange errors that I cannot discern. 在阅读本教程的第一个示例时,我遇到了一些我无法辨别的奇怪错误。 The following is the script I am trying to run: 以下是我尝试运行的脚本:

import pyglet

win = pyglet.window.Window()

@win.event
def on_draw():
    win.clear()

pyglet.app.run()

2 The following is the output I received from the python interpreter after I imported my script: 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
  1. How can I fix these errors? 我该如何解决这些错误? I use Ubuntu 12.04 LTS and Emacs 24.3. 我使用Ubuntu 12.04 LTS和Emacs 24.3。
  2. I have downloaded pyglet, through apt-get install but is there anything else I needed to do? 我已经通过apt-get install下载了pyglet但是还有什么我需要做的吗? Perhaps I do not have drivers configured or I need different software. 也许我没有配置驱动程序或者我需要不同的软件。

If you need more information let me know! 如果您需要更多信息,请告诉我们!

GL_COlOR_BUFFER_BIT未定义,因为您要查找的值称为GL_CO L OR_BUFFER_BIT ...

For future reference, as of Pyglet 1.1.4, this is because 1.1.4 no longer supports "recent" versions of Mac OS. 为了将来参考,从Pyglet 1.1.4开始,这是因为1.1.4不再支持Mac OS的“最新”版本。

However, the most recent non-released version of Pyglet DOES support, with a full new interface using Cocoa. 但是,最新的非发布版本的Pyglet DOES支持使用Cocoa的全新界面。 So, until Pyglet 1.2 is released, you have to install Pyglet directly from the trunk, using eg 因此,在Pyglet 1.2发布之前,你必须直接从主干安装Pyglet,例如

pip install --upgrade http://pyglet.googlecode.com/archive/tip.zip

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM