Displaying PShapes

As part of my larger Scribble Portrait series, I’m trying to make all the scribbles shapes that I can add as children to a parent shape, to manipulate them all together after they’ve been drawn. I’m having trouble getting shapes created with createShape() to render.

The following code doesn’t draw anything… am I missing or misusing something here?

PShape curve;

void setup() {
  size(600, 600, P3D);
  background(255);
  stroke(0);
  strokeWeight(1);
}

void draw() {
   curve = createShape();
   curve.setStroke(0);
   curve.beginShape();
   for(int i=0; i<20; i++) {
     curve.curveVertex(random(width),random(height),random(100));
   }
   curve.endShape();
   shape(curve);
}

Your shape is drawing. The problem is that it’s drawing white shapes on a white background, so you can’t see it.

Try changing your background color to red, and your frame rate to 1 to see what I mean.

  background(255, 0, 0);
  frameRate(1);

You can fix this by setting the fill and stroke of the shape:

   curve.beginShape();
   curve.noFill();
   curve.stroke(0);

PS: Your scribble project is pretty cool! I’d be curious to hear more about your experience selling on the internet sometime.

basically, if it would work you would create 60 different shapes per second…

sorry, i changed too much, but to give you a idea
about the sketch structure i would use:

PShape curve;

void setup() {
  size(200, 200,P3D);
  make_curve();
}

void make_curve() {
  curve = createShape();
  curve.beginShape();
  for (int i=0; i<20; i++)
            curve.curveVertex(random(width), random(height),0);
  curve.endShape();  
  curve.setStroke(color(200, 0, 0));
  curve.setFill(color(0,200,0));
}

void draw() {
  background(200,200,0);
  shape(curve,0,0);
}

void mousePressed() {
 make_curve(); 
}


Ahh, word… wasn’t setting the stroke right on the shape, and didn’t realize that a noFill() in setup didn’t apply to the shapes. Thank you!!

Thanks for the kind words. Happy to share more about the little business, hit me up hello@stirman.net :slight_smile:

hay alguna forma de aprender a hacer scribble portraits? es para un pen plotter