you would not need the ordered group if you used a depth value though right? because that value between 1 and 0 would determine the order?
On Sunday, November 1, 2015 at 8:42:28 PM UTC, [email protected] wrote: > > You can still batch render the sprites using vertex lists, though I don' t > think pyglets built in Sprite class supports Z coords. > > import pyglet > from pyglet.gl import * > > > class Example(pyglet.window.Window): > def __init__(self): > super(Example, self).__init__(640, 480, resizable=False, > fullscreen=False, caption="Example") > self.clear() > > self.render = pyglet.graphics.Batch() > > self.texture1 = pyglet.image.load('sample.png').get_texture() > self.texture2 = pyglet.image.load('sample2.png').get_texture() > > self.images = [] > > self.images.append(self.render.add(4, pyglet.gl.GL_QUADS, group(1 > ), > ('v3f',((16),(16),0.999996, 32+(16),(16),0.999996, 32+(16 > ),32+(16),0.999996, (16),32+(16),0.999996)), > ('t3f',(self.texture1.tex_coords)))) > > self.images.append(self.render.add(4, pyglet.gl.GL_QUADS, group(2 > ), > ('v3f',((32),(32),0.999995, 32+(32),(32),0.999995, 32+(32 > ),32+(32),0.999995, (32),32+(32),0.999995)), > ('t3f',self.texture2.tex_coords))) > > pyglet.clock.get_fps() > self.fps_display = pyglet.clock.ClockDisplay() > pyglet.clock.schedule_interval(self.update, .01) > > > def update(self,dt): > self.draw() > > > def draw(self): > self.clear() > #enable depth sorting > glClear(GL_DEPTH_BUFFER_BIT) > glEnable(GL_DEPTH_TEST) > #bind textures for rendering batch(s) > glEnable(GL_TEXTURE_2D) > self.render.draw() > glDisable(GL_TEXTURE_2D) > #disable depth sorting > glDisable(GL_DEPTH_TEST) > > self.fps_display.draw() > > > class group(pyglet.graphics.OrderedGroup): > def set_state(self): > if self.order == 1: > glBindTexture(GL_TEXTURE_2D, window.texture1.id) > if self.order == 2: > glBindTexture(GL_TEXTURE_2D, window.texture2.id) > > > if __name__ == '__main__': > window = Example() > pyglet.app.run() > > > -- 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/d/optout.
