On Fri, Jul 27, 2012 at 2:51 PM, Balajee R.C <balaje
...@gmail.com> wrote:
> I am trying to create a tiled texture from a small base image (I'm using a
> small beam image and want to tile it along x direction to produce a long
> beam).
> The code I am using to do this is as follows:
> baseImage = pyglet.resource.image('beam.png')
> beamTiledImage = pyglet.image.TileableTexture.create_for_image(baseImage)
> beamTiledImage.blit_tiled(0.0, 0.0, 0.0, 300, 12)
> sprite = pyglet.sprite.Sprite(beamTiledImage)
> However, this gives me the original image intact. Am I doing something
> wrong? Is this the entirely wrong way to go about it?
I don't _know_ since I haven't tried this out, but I would guess that
you should actually run the beamTiledImage.blit_tiled(0.0, 0.0, 0.0,
300, 12) command inside your draw loop.
In other words, I don't think that command modifies the "image" part
of the TileableTexture object itself, which is what it appears you
expected since you are putting that texture into a sprite.
~ Nathan