You can get depth sorting by enabling GL_DEPTH_TEST before blitting, and
the depth range is handled as a float between 1.0 to 0.0, for example:
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.image = pyglet.image.load('sample.png').get_texture()
self.image2 = pyglet.image.load('sample2.png').get_texture()
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)
#draw images with x/y/z
self.image.blit(0,0,0.999997)
self.image2.blit(16,16,0.999996)
#disable depth sorting
glDisable(GL_DEPTH_TEST)
self.fps_display.draw()
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.