Turning off antialiasing in Löve2D

Posted by cjanssen on Stack Overflow See other posts from Stack Overflow or by cjanssen
Published on 2009-08-13T13:26:54Z Indexed on 2010/12/31 17:54 UTC
Read the original article Hit count: 280

Filed under:
|
|
|

I'm using Löve2D for writing a small game. Löve2D is an open source game engine for Lua. The problem I'm encountering is that some antialias filter is automatically applied to your sprites when you draw it at non-integer positions.

love.graphics.draw( sprite, x, y )

So when x or y is not round (for example, x=100.24), the sprite appears blurred. The same happens when the sprite size is not even, because (x,y) points to the center of the sprite. For example, a sprite which is 31x30 big will appear blurred again, because its pixels are painted in non-integer positions.

Since I am using pixel art, I want to avoid this all the way, otherwise the art is destroyed by this effect. The workaround I am using so far is to force the coordinates to be round by littering the code with calls to math.floor(), and forcing all the sprites to have even sizes by adding a row or column of transparent pixels with the paint program, if needed.

Is there some command to deactivate the antialiasing I can call at program startup?

© Stack Overflow or respective owner

Related posts about game-development

Related posts about graphics