batches and z-ordering

84 views
Skip to first unread message

Nitneroc

unread,
Jan 10, 2013, 3:55:17 PM1/10/13
to cocos-...@googlegroups.com
I haven't been able to use cocos lately, and I realize I have forgotten many thnigs...

It seems that batches don't take care of ordering, but I really need the speed of a batch and careful ordering. Is this even possible ? should I use pyglet batches instead of cocos ones ? Is there a workaround ?
I tried to correct this with no luck, could someone point me in the right direction ?

Nitneroc

unread,
Jan 16, 2013, 2:43:52 PM1/16/13
to cocos-...@googlegroups.com
Ok, I honestly don't have a deep enough knowledge of cocos/pyglet/openGL, but I managed to get my batches to do what I ask of them (respect the z-order I want), by changing the usage of pyglet Group to OrderedGroup : the only change I made is this, in batch.BatchableNode : 
def set_batch(self, batch, groups=None, z=0):
    self.batch = batch
    if batch is None:
        self.group = None
    else:
        group = groups.get(z)
        if group is None:
            import pyglet
            group = pyglet.graphics.OrderedGroup(z) # this is the only line I changed
            groups[z] = group
        self.group = group
    for childZ, child in self.children:
        child.set_batch(self.batch, groups, z + childZ)

It seems that it used to be OrderedGroups, but this changed in r807, and every commit made since that time was for licence and such... I really don't know if this change will create some other problems, some performance troubles or anything, all I know is that it's currently doing the job for my current needs.
Reply all
Reply to author
Forward
0 new messages