Properly scaling pixel art with lwjgl and slcik-util

Started by Jumbosize, August 15, 2012, 01:10:54

Previous topic - Next topic

Jumbosize

Hello,

I have come across a small dilemma with scaling images. I am loading my images pretty much exactly how it is shown the Ninja Cave tutorial (http://lwjgl.org/wiki/index.php?title=Slick-Util_Library_-_Part_1_-_Loading_Images_for_LWJGL).  The problem is this method automatically applies anti aliasing (I believe that's what it is, right?) to the images. Since I'm making a pixel art with quite small images that need to be heavily scaled up, this is a pretty big deal. Pixel art is supposed to be very sharp.

Is there a way to make the images scale up crisply without blurring? Thanks in advance.

Fool Running

Quote from: Jumbosize on August 15, 2012, 01:10:54
Hello,

I have come across a small dilemma with scaling images. I am loading my images pretty much exactly how it is shown the Ninja Cave tutorial (http://lwjgl.org/wiki/index.php?title=Slick-Util_Library_-_Part_1_-_Loading_Images_for_LWJGL).  The problem is this method automatically applies anti aliasing (I believe that's what it is, right?) to the images. Since I'm making a pixel art with quite small images that need to be heavily scaled up, this is a pretty big deal. Pixel art is supposed to be very sharp.

Is there a way to make the images scale up crisply without blurring? Thanks in advance.
The proper term for the "blurring" of an image when stretched is called interpolation. :)

Unless you want it to look pixelated when zoomed up (which it sounds like you don't want either), you are stuck with two options:
1) Make the images larger so they don't stretch.
2) Create a pixel shader that does what you want to the image when it is stretched.

EDIT: If you do just want to get rid of the blurriness, then use the TextureLoader.getTexture() overload that takes a filter and pass in GL11.GL_NEAREST as the value.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

CodeBunny

I'm pretty sure he just wants to use GL_NEAREST. That's all you need to get good pixel art.