Hi all
I'm coding on a context free art type of geometry renderer.
Now i faced a problem than when having a defined an vertexlist and
migrating it from one group to another,
the indexed triangles get messed up:
I'm using the pyglet 1.2dev repository. just pulled a few minutes ago.
On mac os x 11.4 (Lion) and with cocoa/64bit activated.
attached is the simplest piece of code to reproduce the behavior:
i migrate a square (2 indexed triangles) from one group to another. one
triangles goes black.
what is wrong, or is this possibly a bug?
thanks for any help on this.
pat
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/groups/opt_out.
import pyglet
from primitives import *
class Group(pyglet.graphics.Group):
""" Sets OpenGL state for the object which belongs to this group """
def __init__(self, x=0,y=0,z=0,parent=None):
super(self.__class__, self).__init__(parent=parent)
self.x = x; self.y = y; self.z = z
def set_state(self):
glPushMatrix()
glTranslatef(self.x, self.y, self.z)
def unset_state(self):
glPopMatrix()
if __name__ == "__main__":
window = pyglet.window.Window(1200, 900)
batch = pyglet.graphics.Batch()
@window.event
def on_draw():
window.clear()
batch.draw()
# square from 2 triangles
N = 4
indices = [0,1,2,2,3,0] # indices order doesn't seem to fix it
vertices = [-100,-100,0,100,-100,0,100,100,0,-100,100,0]
colors = [1,1,1,1,]*4
A = Group(x=400,y=450)
B = Group(x=800,y=450)
# original
v0 = batch.add_indexed(N, pyglet.gl.GL_TRIANGLES,
A,
indices,
('v3f',vertices),
('c4f',colors))
# same, will be migrated
v1 = batch.add_indexed(N, pyglet.gl.GL_TRIANGLES,
A,
indices,
('v3f',vertices),
('c4f',colors))
# migrate v1
batch.migrate(v1,
mode=pyglet.gl.GL_TRIANGLES,
group=B,
batch=batch)
pyglet.app.run()