I am using a standard blending of GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA. 
Here is an example of what doesn't work:

import pyglet, random
from pyglet.gl import *

window = pyglet.window.Window(800,600, vsync=False)

fps = pyglet.clock.ClockDisplay()

groups = []
group = pyglet.graphics.Group()

tileImages = [pyglet.image.load("tile_test.png")]
        
batch = pyglet.graphics.Batch()

fadedImage = pyglet.image.load("wide-shadow-faded.png").get_texture()
playerImage = pyglet.image.load("player.png").get_texture()
treeImage = pyglet.image.load("tree.png").get_texture()


glEnable(GL_DEPTH_TEST)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glAlphaFunc ( GL_GREATER, 0.1 ) ;
glEnable ( GL_ALPHA_TEST ) ;

tiles = []
for i in range(40):
    for j in range(40):
        tile = pyglet.sprite.Sprite(random.choice(tileImages), batch=batch, 
x=i*24, y=j*24, usage='static', group=group, subpixel=True)
        tiles.append(tile)
    
print len(tiles)


player = pyglet.sprite.Sprite(playerImage, batch=batch, group=group, x=10, 
y=10, z=0.3, subpixel=True)

tree = pyglet.sprite.Sprite(treeImage, batch=batch, group=group, x=30, 
y=30, z=0.5, subpixel=True)

fadedSprite = pyglet.sprite.Sprite(fadedImage, batch=batch, group=group, 
x=100, y=100, z=0.5, subpixel=True)


@window.event
def on_draw():
    window.dispatch_events()
    window.clear()
    batch.draw()
    fps.draw()
    
pyglet.app.run()
    


The 'fadedImage' is basically just any image that has pixels of alpha 
between 0 and 1 like a fade. If you take out the player and sprite, it may 
sometimes show up properly, but if you reload it may change to all black, 
it's never consistent.


On Tuesday, August 30, 2016 at 11:53:29 PM UTC-5, magu...@gmail.com wrote:
>
> In what way are you blending objects? The source of that issue could be a 
> number of things, could you provide a working example? Generally you should 
> only have to update each visible objects vertices and Z axis every update 
> cycle.
>
> Also, you can increase the depth range of the Z axis by setting up a 
> custom config:
>
> config = Config(sample_buffers=1, samples=4, depth_size=1000, 
> double_buffer=True)
>
> class Example(pyglet.window.Window):
>     def __init__(self):
>         super(Example, self).__init__(640, 480, resizable=True, fullscreen
> =False, caption="Example", config=config)
>
>
>

-- 
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 pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
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