you are right!

whether or not the black borders appear depends on what i set for the
texture atlas size and everything else than 33x33 fails with black
borders again.
here a complete example:

#!/usr/bin/python

import pyglet

def _texture_atlas_add(self, img):
    pad = 1
    x, y = self.allocator.alloc(img.width + pad, img.height + pad)
    self.texture.blit_into(img, x + pad, y + pad, 0)
    region = self.texture.get_region(x + pad, y + pad, img.width,
img.height)
    return region
pyglet.image.atlas.TextureAtlas.add = _texture_atlas_add

atlas = pyglet.image.atlas.TextureAtlas(width=64, height=64)
tile = []
tile.append(atlas.add(pyglet.image.load('data/tiles/water/0
watrtl01.pcx/0.png')))
tile.append(tile[0].get_transform(flip_x=True))
tile.append(tile[0].get_transform(flip_y=True))
tile.append(tile[0].get_transform(flip_x=True, flip_y=True))
group = pyglet.graphics.TextureGroup(atlas.texture)

batch = pyglet.graphics.Batch()

tex_coords = []
vert_coords = []
for y in xrange(2):
    y1 = y*32
    y2 = y1+32
    for x in xrange(2):
        x1 = x*32
        x2 = x1+32
        tex_coords.extend(tile[2*y+x].tex_coords)
        vert_coords.extend([x1, y1, x2, y1, x2, y2, x1, y2])

vl = batch.add(4*4, pyglet.gl.GL_QUADS, group, ('v2i', vert_coords),
    ('t3f', tex_coords), ('c4B', (255,255,255,255)*4*4))

window = pyglet.window.Window(256, 256)

@window.event
def on_draw():
    window.clear()
    pyglet.gl.glPushMatrix()
    pyglet.gl.glScalef(4.0,4,0.0)
    batch.draw()
    pyglet.gl.glPopMatrix()

pyglet.app.run()

just put in a 32x32 image that then will be flipped and drawn to four
different positions.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to