Hello processing community !
I’m trying to code a function to make a PShape that has the form of a blob.
My problem is that it doesn’t work with JAVA2D (default renderer) but it ok with P2D.
It seems to be bound to curveVertex because if I change it with vertex everything is OK (with both renders).
Has anyone an idea to solve this ? Thank you for reading me 
void setup() ;
size(800, 800);
noLoop();
PShape blob;
blob = createBlob( width/2,height/2,300,5);
shape(blob,0,0);
}
PShape createBlob(int x0, int y0, int radius, int N) {
PVector[] points = new PVector[N];
PShape ps = createShape();
for (int i=0; i<N; i++) {
float tempRadius = random(radius/2, radius*3/2);
float x =x0 + tempRadius*cos(i*TAU/N);
float y =y0 + tempRadius*sin(i*TAU/N);
points[i] = new PVector(x, y);
}
ps.beginShape();
ps.fill(0);
for (int i = 0; i < N; i++)
{
ps.curveVertex(points[i].x, points[i].y);
}
for (int i=0; i<3; i++)
ps.curveVertex(points[i].x, points[i].y);
ps.endShape(CLOSE);
return ps;
}
Hi @DrHooDoo 
You are right. It looks like curveVertex()
doesn’t work properly with PShape in Java2D.
Here’s a previous thread on this topic that might be helpful:
Note: This is a known issue (with a “help wanted” tag by the way if someone feels like looking into it
)
2 Likes