Aliasing issue Processing 4

Hello @Chriz96 ,

This is with Processing 4.4.10 and W10.

Other versions may behave differently.

Give this a try:

float a;

//If using Windows scaling add this for 1:1 rendering on some versions:
static
  {
  // JAVA2D: 
  // Forces 1:1 pixel rendering by disabling OS-level DPI scaling
  System.setProperty("sun.java2d.uiScale", "1.0");
  }

void setup() {
  size(600, 600);
  //size(600, 600, P2D); //Try different renderers
 
  translate(width/2, height/2);
  rectMode(CENTER);
  
  //smooth(4);  //See reference and try different values
  
  pixelDensity(1); //Try this if you have a high density display.
}

void draw() {
  // You must have this otherwise it keeps painting over window:
  background(255);   
  
  translate(width/2, height/2);
  rotate(radians(22.5));
  rect(0, 0, 200, 200);
  //a += 0.02;
}

//void mousePressed() {
//  saveFrame("any3.png");
//}

You will have to experiment and comment \ uncomment lines of code and make changes.

Also look up the references for each.

Reference (this may depend on Processing version used):

Before (without static block):

After (with static block):

Please report your results.

Additional reference:

I do not have a solution to upscale it to the windows scaling without aliasing.

:-)

1 Like