Last active
August 29, 2015 13:57
-
-
Save reidrac/9874610 to your computer and use it in GitHub Desktop.
Use pyglet sprites, but with a scaling filter that suits pixelated graphics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Class to use Pyglet 1.2 sprites, but with a scaling filter that suits pixelated graphics. | |
Just import and use PixSprite as it was a Sprite! | |
""" | |
import pyglet | |
from pyglet import gl | |
class PixSprite(pyglet.sprite.Sprite): | |
def __init__(self, *args, **kwargs): | |
super(PixSprite, self).__init__(*args, **kwargs) | |
gl.glTexParameteri(self._texture.target, gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST) | |
gl.glTexParameteri(self._texture.target, gl.GL_TEXTURE_MIN_FILTER, gl.GL_NEAREST) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment