We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › apparent smooth problems
Page Index Toggle Pages: 1
apparent smooth problems (Read 269 times)
apparent smooth problems
Jul 13th, 2008, 6:46pm
 
I thought I should post about the smooth() function as it confused me at first. Hopefully this will be helpful.

I use functions in a very basic setup to test how they work and more easily remember them. In testing smooth I would use a setup like so:
Quote:


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

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




Which would produce a circle without any apparent smoothing. The circle is being drawn over and over since the draw code is repeated while the program executes. The semi-transparent edges of the circle are apparently building up and becoming opaque destroying the smoothing.

To see the smoothing the background needs to be cleared (as in the following example) or the ellipse() function must be called from an event or somewhere where it will only be executed once.

Quote:


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

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


Re: apparent smooth problems
Reply #1 - Jul 13th, 2008, 11:46pm
 
Mmm, thanks for sharing.
To complete the info, there are other alternatives:

void setup() {
 size(400,400);
 noStroke();
 smooth();
 ellipse(200,200,100,100);
}

Drawn once, static image.

void setup() {
 size(400,400);
 noStroke();
 smooth();
 noLoop();
}

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

Idem, closer of your design.
Page Index Toggle Pages: 1