In my game, I'm using one big batch to draw all my sprites. For my
bullet class, I decided to use vertexlists instead of a sprite:
# __init___
self.vertex_list = batch.add(2, GL_LINES, objects,
                        ('v2f/stream', (self.x, self.y, self.px, self.py)),
                        ('c4B/static', (244, 233, 200, 255,236,216,25,0)))

So far so good. I update these positions in an update method:
self.vertex_list.vertices = [self.x, self.y, self.p2x, self.p2y]

Still good so far. Now, when any entity is deleted, it gets removed
from the entity set and  it's sprite or in this case vertexlist must
get removed from the batch. With sprites, this is as simple as setting
the batch to None, however for vertex lists the only option is to call
vertex_list.delete(). However, in game this causes one of two errors:

...
  File "/home/mitchell/Programming/python/spaceoddity/entities.py",
line 72, in destroy
    self.vertex_list.delete()
  File "/usr/lib/pymodules/python2.6/pyglet/graphics/vertexdomain.py",
line 366, in delete
    self.domain.allocator.dealloc(self.start, self.count)
  File "/usr/lib/pymodules/python2.6/pyglet/graphics/allocation.py",
line 289, in dealloc
    assert p >= 0 and size <= alloc_size - p, 'Region not allocated'
AssertionError: Region not allocated

And sometimes, the error given is this:
  File "/home/mitchell/Programming/python/spaceoddity/entities.py",
line 72, in destroy
    self.vertex_list.delete()
  File "/usr/lib/pymodules/python2.6/pyglet/graphics/vertexdomain.py",
line 366, in delete
    self.domain.allocator.dealloc(self.start, self.count)
  File "/usr/lib/pymodules/python2.6/pyglet/graphics/allocation.py",
line 279, in dealloc
    assert self.starts
AssertionError

I think I should also note that I am using the ubuntu repository
version of pyglet, which isn't necessarily the latest version (it is
1.1.2 according to synaptic). Did I miss something completely or is
this a problem with pyglet itself?

-- 
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