I try to rotate a simple sprite with this code:
test_img = pyglet.resource.image('img.png')
self.test_sprite = pyglet.sprite.Sprite(img=test_img,x=300,y=400, batch=self.main_batch)
def update(self, dt):
self.test_sprite.rotation -= float(100 * dt)
it works great, but I see artifact while it rotates, see the picture below, the left is a static image, the right is the one rotating:
I did a quick search and I find a discussion regarding it here:
https://groups.google.com/forum/#!topic/pyglet-users/5NiNT1vRHGw
But honestly I'm a newbie in pyglet and I don't get how should I amend the code above to remove the artifact.
UPDATE:
I fix the issue with the following code, but still not sure if it's the best way to do it:
test_img = pyglet.resource.image('img.png').get_texture()
glTexParameteri(test_img.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameteri(test_img.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
self.test_sprite = pyglet.sprite.Sprite(img=test_img,x=300,y=400, batch=self.main_batch)
def update(self, dt):
self.test_sprite.rotation -= float(100 * dt)