I apologize for the delay, I didn't really check back here after there
wasn't much activity for a few weeks and figured I wouldn't be able to do
what I needed.
Thanks for taking the time to test this! I did not realize the sprite group
resets things as well. I did try it and it does seem a lot better than what
I had implemented. However, the same alpha issues do arise; some things on
the same z level will have proper alpha while other objects may not. I did
have to change to 0.1 instead of 0.5 for it to even show up at all. I
suspect this might be part of the opacity stuff you were talking about.
On Friday, September 30, 2016 at 9:30:19 AM UTC-5, Benjamin Moran wrote:
> Hi Charles,
> I have a zsprite branch (that probably has the same changes that you've
> already made) that can be found here:
> The OpenGL blending/code you posted looks fine, but it might be getting
> overridden by the SpriteGroup (pyglet.sprite.SpriteGroup) . My branch is
> not yet complete, but I've also modified the SpriteGroup class so that it's
> at least working OK for me. it only works right for simple
> transparent/solid alpha (not opacity), but it does render all sprites in
> the correct z order. Give it a try and see if it works for you. The z
> scale is set to be from -255 to 255.
> I will probably fix the opacity stuff at some point...
> On Thursday, September 1, 2016 at 8:28:43 AM UTC+9, Charles wrote:
>> 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()
>> 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)
>> 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)
>> def on_draw():
>> 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
>>> 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,
>>> 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
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to firstname.lastname@example.org.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.