Hm, odd. I re-ran some tests and they seem to work. the sprite.py file is 
meant to replace the sprite.py in your pyglet install directory IE:* 
C:\python27\lib\site-packages\pyglet\*. Once you do that you could try this 
example script:

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.texture1 = pyglet.image.load('sample.png').get_texture()
        self.texture2 = pyglet.image.load('sample2.png').get_texture()

        self.batch = pyglet.graphics.Batch()

        self.sprite1 = pyglet.sprite.Sprite(self.texture1,batch=self.batch,
group=group(1))
        self.sprite1.position = 64,64,0.9
        self.sprite = pyglet.sprite.Sprite(self.texture2,batch=self.batch,
group=group(2))
        self.sprite.position = 48,48,0.8
        self.sprite.x = 54

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

Reply via email to