简体   繁体   中英

python pyglet and opengl

I am trying to get 3D capabilities through python and have download 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:

>>> 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.
  2. I have downloaded pyglet, through apt-get install but is there anything else I needed to do? 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.

However, the most recent non-released version of Pyglet DOES support, with a full new interface using Cocoa. So, until Pyglet 1.2 is released, you have to install Pyglet directly from the trunk, using eg

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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