Loading...
Logo
Processing Forum
When I run this sketch:

size(400, 400);
ellipse(200, 200, 100, 100);

and this sketch:

void setup() {
  size(400, 400);
}

void draw() {
  ellipse(200, 200, 100, 100);
}

The quality of the antialiased ellipse shape differs. Below are two screenshots, the first is "static" mode the second is the "active" mode.


Can anyone explain why the two are so different?


Replies(5)

In active mode, you're continually drawing an ellipse onto the screen because of the draw() loop. This means the anti-aliasing pixels continuously draw over each other. 
 
If you call background() during the draw() loop or call noLoop() in setup, it should look better.
 
Copy code
  1. void draw() {
  2.   background(150);
  3.   ellipse(200, 200, 100, 100);
  4. }
*derp* thanks.

A classical...
Equivalent to the static mode:
Copy code
  1. void setup() {
  2.   size(400, 400);  ellipse(200, 200, 100, 100);
  3. }
(no draw, no repeat)
or:
Copy code
  1. void setup() {
  2.   size(400, 400);
  3.   noLoop();
  4. }
  5.  
  6. void draw() {
  7.   ellipse(200, 200, 100, 100);
  8. }

The answer is simple: antialiasing algorithms blur objects edges making then softer. If you are putting circles one in top of the other, the transparent pixels in the edge mix in that awful way :P Just remember to call background to clean the image at every iteration. 

Best Regards.
Yes, thanks everyone. It had just been ages since I'd worked in static mode.