noSmooth() doesn't works with P2D

Hello,
I’m doing a little game and I’m using pixel art images so I need to use noSmooth() which doesn’t works in P2D…
I would like to know if there is another way to use pixel art in P2D.

Sorry about mistakes, I’m french. :slight_smile:

LBP26M4O5IQ7

Hi, are you resizing the image when drawing it?

Can we have a working example to help you with?

Yes i’m resizing images

And here is the game : Flappy Nyan

I think it is due to the resizing. When you work with “pixel art” you don’t want to resize your images because you will end up with blurry lines.

Oh… Okay
So how can i do ?

i found how to do, thanks anyway

Happy to hear that :slight_smile:

Can you explain what you did in case other people come here to find an answer to a similar project?

yes sure

Do that for every images

2 Likes

Hi,
I found that this

((PGraphicsOpenGL)g).textureSampling( 3 );

instead of noSmooth(); might help? Haven tried it myself.

Source: https://github.com/processing/processing/issues/5363 -> https://forum.processing.org/two/discussion/24084/nosmooth-isnt-working-in-p3d -> https://forum.processing.org/two/discussion/comment/22759/#Comment_22759

1 Like

I’ll keep this code and try later, thanks

Can confirm now. It works!

PImage img;

void setup() {
  size(500, 700, P2D);
  //size(500, 700);
  img = loadImage("key.png");
  //noSmooth();
  ((PGraphicsOpenGL)g).textureSampling( 3 );
}

void draw() {
  background(0);
  image(img, 0, 0, 500, 700);
}

key

^ There is a very small picture to scale up btw.

1 Like