Very weird. Looks like a bug. It depends on the order of the points:
function setup() {
createCanvas(150, 100, WEBGL);
smooth();
}
function draw() {
background(220);
fill(100);
beginShape();
vertex(1, 1);
vertex(30, 15);
vertex(60, 2);
vertex(61, 30);
vertex(1, 35);
endShape(CLOSE);
}
function setup() {
createCanvas(150, 100, WEBGL);
smooth();
}
function draw() {
background(220);
fill(100);
beginShape();
vertex(30, 15);
vertex(60, 2);
vertex(61, 30);
vertex(1, 35);
vertex(1, 1);
endShape(CLOSE);
}
Notice I just move the first point to be the last one.
In motion: https://editor.p5js.org/abe/sketches/B1691vDi7
Maybe related?