hey! i tried out this code snippet because after scaling my scene i
somehow got this strange effect and here is my story:
first i had a 32x32 image in a 32x32 TextureAtlas. i flipped the image
around a few times and drew those in a batch.
then i added scaling and obviously one can see the borders overlap:
after that i added this code snippet of yours and i had still an
issue: instead of showing parts of the neighbor texture (in this case
of itself) i got a black border.
this is the 32x32 texture in a 34x34 Texture atlas with your code
snippet above:
not caring about those still messed up borders i thought about an
optimization of your code:
with your code one has effectively 2px empty space between the images
but from my understanding it should suffice to only have 1px empty
space so i modified your code to this:
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
i expected that the same issues would happen as with your code above
but surpsingly now it seems to work!
this is the 32x32 texture in a 33x33 Texture atlas with modified
texture atlas add:
so... why does it work? does it work?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---