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 & HelpPrograms › smooth() and draw()
Page Index Toggle Pages: 1
smooth() and draw() (Read 365 times)
smooth() and draw()
Feb 11th, 2009, 2:10pm
 
Hi!

i placed the same instruction in the function draw() and later in the setup() with smooth() always turned on. These are the outputs:

Code:

void setup() {
 size(400,400);
 background(0);
 smooth();
 noFill();
 strokeCap(SQUARE);
 stroke(#ff291c);
 strokeWeight(50);
 arc(200,200,200,200,(PI*5/8),(0));
}

void draw() {
}

produce this output:
http://pole.altervista.org/processing/img2.png



this code:

void setup() {
 size(400,400);
 background(0);
 smooth();
 noFill();
 strokeCap(SQUARE);
}

void draw() {
 stroke(#ff291c);
 strokeWeight(50);
 arc(200,200,200,200,(PI*5/8),(0));
}

produce this output:
http://pole.altervista.org/processing/img1.png

how can i resolve this problem and display the arc in perfect smooth (like the first code)?

Tnx

Pole
Re: smooth() and draw()
Reply #1 - Feb 11th, 2009, 2:33pm
 
i moved more and more of the setup code into draw (thinking moving just the smooth would be enough). i ended up with

Code:

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

void draw() {
background(0);
smooth();
noFill();
strokeCap(SQUARE);
stroke(#ff291c);
strokeWeight(50);
arc(200,200,200,200,(PI*5/8),(0));
}


which worked. but may have issues (do you want to clear the background every frame? is there a performance hit in doing this?)

curious.
Re: smooth() and draw()
Reply #2 - Feb 11th, 2009, 2:41pm
 
Tnx! So the problem is background(0)!
About your question: yes, i prefer to do less istruction per frame as possible.

Thanks very much!

Pole
Re: smooth() and draw()
Reply #3 - Feb 11th, 2009, 4:23pm
 
Lol! See antialiasing fonts... :-D
Page Index Toggle Pages: 1