Pshape ... not in shape

Why is the droplet working with the code which is commented out and not in the Pshape version?

 //fill(0, 0, 255);
//beginShape();
//vertex(50, 10);
//bezierVertex(50, 10, 5, 50, 50, 60);
//bezierVertex(70, 50, 70, 30, 50, 10);
//endShape();

PShape drup;

void setup() {
  size(100, 100);
  drup = createShape();
  drup.beginShape();
   //drup.noStroke();
  drup.fill(0, 0, 255);
  drup.vertex(50, 10);
  drup.bezierVertex(50, 10, 5, 50, 50, 60);
  drup.bezierVertex(70, 50, 70, 30, 50, 10);
  drup.endShape();
}

void draw() {
  background(204);
  shape(drup, 0, 0);
}


1 Like

Hi, there is indeed some issues when created bezierVertex on a PShape object.

You can use drup = createShape(PShape.PATH); to fix it.

Or you can also change the rendered to P2D size(100, 100, P2D);

2 Likes