Display sharp/aliased graphics when scaling up

If I want to display pixel art at a larger scale, how can I do that without any aliasing ?

I’ve tried ofDisableSmooth() in setup but when I use ofScale() a pixel art image looks blurry.
What’s the simplest way to keep it sharp ?


I was going to post the same question :slight_smile: I’m going through the ofGraphics class, there should be an option somewhere to do this. I’m guessing you’re also using textures, if you are using the OpenGL renderer what should be done is changing the texture filter from GL_LINEAR to GL_NEAREST.

There is a function called ofEnablePointSprites, but that doesn’t do it for me.

I’ll keep looking!

Thanks for the suggestion.

You are correct I am using textures (an ofFbo and an ofImage)
I’ve tried GL_LINEAR and GL_NEAREST and combinations of the two, but the output looks exactly the same.
Here’s the code I’m using:


Am I using this correctly ?


Got it ! I copy pixels from the fbo to the image, so I should set the filter for the image, which is what I display in the end. So after I update pixels I do:


This worked, thanks!

Great! Thanks !

I’m doing the opposite rendering from image to fbo and finally showing the fbo on screen. I’ve set the minmagfilter on setup so it only has to be done once. You should be able to do the same with the ofImage, the settings will be stored for its texture so depending on how you set the texture on update you don’t need to call setTextureMinMagFilter more than once.