Hello, TL;DR:
I made a simple puzzle game with Pyglet as part of my training for the upcoming PyWeek (7 days left, yay!) and because the game didn't have big requirements I didn't bother to use an ImageGrid or a TextureGrid. Yesterday I tried this approach and so far so good, although I got bleeding between adjacent images (as described in Pyglet docs). So I thought about using a Texture3D instead of a TextureGrid. At first I got a texture error when loading the image with resource.image, and I read somewhere that is because I can't blit a Texture into another Texture (that's what you get from resource.image). Fair enough. So I get the image data from the texture and then works, but the results are not what I was expecting... Instead of this: http://i.imgur.com/Pjt1pRr.png I get this: http://i.imgur.com/G5u0IPo.png It's like the grid gets scrambled or something. Attached to this message there are test.py and tiles.png used to reproduce the problem (I can reproduce it with both Pyglet 1.1.4 and 1.2 alpha1, although I'm using the later for my tests because of the joystick support). I don't know what's going on and I've spent hours reading Pyglet's source code. Any pointers would be greatly appreciated! Kind regards, Juan -- jjm's home: http://www.usebox.net/jjm/ blackshell: http://blackshell.usebox.net/ -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
"""
Testing Texture3D weirdness
"""
import pyglet
window = pyglet.window.Window()
# if I don't get the image data, resource.image returns a
# Texture that will fail when used with Texture3D; not sure
# if it's the correct thing to do
image = pyglet.resource.image("tiles.png").get_image_data()
grid = pyglet.image.ImageGrid(image, 1, 6)
texture = pyglet.image.Texture3D.create_for_image_grid(grid)
# use following line to get the result I believe is correct
#texture = pyglet.image.TextureGrid(grid)
pyglet.gl.glEnable(pyglet.gl.GL_BLEND)
pyglet.gl.glBlendFunc(pyglet.gl.GL_SRC_ALPHA, pyglet.gl.GL_ONE_MINUS_SRC_ALPHA)
@window.event
def on_draw():
window.clear()
for index in range(len(texture)):
texture[index].blit(index*texture[index].width, 0)
pyglet.app.run()
<<attachment: tiles.png>>
