Perfect, the addition of
glEnable(GL_ALPHA_TEST)
glAlphaFunc(GL_GREATER, .1)

Seemed to be the solution! I appreciate the help, I can continue from here.

@Elliot, Sorry, it seems to default me to an old account when coming here 
for some reason. 

On Tuesday, May 3, 2016 at 5:38:55 PM UTC-5, [email protected] wrote:
>
> That may be more of an OpenGL question, and may have to do with rendering 
> orders in memory. Unfortunately I can't offer much more than that having 
> not played with depth testing to any great degree. From the tests i've 
> done, provided I stay within the depth ranges of 1.0 - 0.0, it seems to 
> render layers and alpha blending fine. Depending on your needs that may be 
> enough, but otherwise unless someone else happens along with a more clear 
> answer, you may want to start looking into lower level OpenGL calls.
>
> Here's the current test script (assuming the images already have 
> transparency applied):
>
> import pyglet
> from pyglet.gl import *
>
> class group(pyglet.graphics.OrderedGroup):
>     def set_state(self):
>         if self.order == 0:
>             glBindTexture(GL_TEXTURE_2D, texture.id)
>         elif self.order == 1:
>             glBindTexture(GL_TEXTURE_2D, texture2.id)
>
> window = pyglet.window.Window(640,480)
>
> glEnable(GL_DEPTH_TEST)
>
> gl.glEnable(GL_BLEND)
> gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
>
> glEnable(GL_ALPHA_TEST)
> glAlphaFunc(GL_GREATER, .1)
>
> rendered_sprites = []
>
> batch = pyglet.graphics.Batch()
>
> batch_idle = pyglet.graphics.Batch()
>
> texture = pyglet.image.load('test3.png').get_texture()
>
> texture2 = pyglet.image.load('test4.png').get_texture()
>
> background = pyglet.image.load('background.png').get_texture()
>
> rendered_sprites.append(batch.add(4, GL_QUADS, group(0),
>                                   ('v3f/static', (0.0,0.0,0.1, 32.0,0.0,
> 0.1, 32.0,32.0,0.1, 0.0,32.0,0.1)),
>                                   ('t3f/static', texture.tex_coords)))
>
> rendered_sprites.append(batch.add(4, GL_QUADS, group(1),
>                                   ('v3f/static', (16.0,0.0,0.1, 48.0,0.0,
> 0.1, 48.0,32.0,0.1, 16.0,32.0,0.1)),
>                                   ('t3f/static', texture2.tex_coords)))
>
>
> @window.event
> def on_draw():
>     window.clear()
>     background.blit(0,0)
>     glEnable(GL_TEXTURE_2D)
>     batch.draw()
>     glDisable(GL_TEXTURE_2D)
>
> @window.event
> def on_key_press(symbol,modifiers):
>     if symbol == pyglet.window.key.SPACE:
>         if round(rendered_sprites[1].vertices[2],2) == 0.1:
>             for a in xrange(2,12,3):
>                 rendered_sprites[1].vertices[a] = 1.0
>         else:
>             for a in xrange(2,12,3):
>                 rendered_sprites[1].vertices[a] = 0.1
>
> 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 https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to