Hi!

I just updated to the current svn version of pyglet and now get the
following exception when creating a vertexbuffer:

>>> import pyglet
>>> from pyglet.gl import *
>>> from pyglet import graphics
>>> vertices = graphics.vertexbuffer.create_buffer(512)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/andy/Projekte/Tools/pyglet/graphics/vertexbuffer.py",
line 82, in create_buffer
    not gl.current_context._workaround_vbo):
AttributeError: 'module' object has no attribute 'current_context'

But the following works just after the exception:

>>> pyglet.gl.current_context
XlibGLContext()
>>> pyglet.gl.current_context._workaround_vbo
False


So i tried patching vertexbuffer.py and got it working with the
following patch:

Index: pyglet/graphics/vertexbuffer.py
===================================================================
--- pyglet/graphics/vertexbuffer.py     (revision 2115)
+++ pyglet/graphics/vertexbuffer.py     (working copy)
@@ -51,7 +51,6 @@
 import sys

 import pyglet
-from pyglet import gl
 from pyglet.gl import *
 from pyglet.gl import gl_info

@@ -79,7 +78,7 @@
     if (vbo and
         gl_info.have_version(1, 5) and
         _enable_vbo and
-        not gl.current_context._workaround_vbo):
+        not pyglet.gl.current_context._workaround_vbo):
         return VertexBufferObject(size, target, usage)
     else:
         return VertexArray(size)
@@ -106,7 +105,7 @@
     if (vbo and
         gl_info.have_version(1, 5) and
         _enable_vbo and
-        not gl.current_context._workaround_vbo):
+        not pyglet.gl.current_context._workaround_vbo):
         return MappableVertexBufferObject(size, target, usage)
     else:
         return VertexArray(size)


But I'm not quite sure why "gl.current_context" does not work, but
"pyglet.gl.current_context" does...


Andy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to