Loading...
Logo
Processing Forum

smooth() wierdness

in Programming Questions  •  3 years ago  
Hello,

I'm wondering why there's this weird little stutter at the beginning if I include the smooth() function in the following code:

Line[] lines;
int lineCount;
float yIncrement;

void setup(){
  size(640, 480);
  smooth();
  lineCount = 10;
  yIncrement = height/lineCount;
  lines = new Line[lineCount];
}

void draw() {
  background(200);
  for (int i = 0; i < lineCount; i++){
    lines[i] = new Line(i*yIncrement, i*10);
    lines[i].drawLine();
  }
}

class Line{
  float y;
  float gray;

  Line(float yPos, float gray){
    this.y = yPos;
    this.gray = gray;
  }

  void drawLine(){
    stroke(gray);
    for (int i = 0; i < width; i++){
      line(i, y, i, height);
    }
    stroke(100);
    line(0, y, width, y);
  }
}
 

If you comment it out it goes away. I know smooth() doesn't really do anything to the sketch as it is right now since it's just a bunch of lines, but eventually I'll be adding some stuff that could use smoothing.


PS. Why does it say this topic is reported as spam?


Replies(2)

I dont see anything different when using smooth or not.
What exactly does it look like?


This is on the screen for about a second before it switches to the correct display. Setting background() to 0 also takes care of it, I'm just curious as to why it's happening.