Why can't I set PShape's stroke with P2D

Hi everyone,
I was wondering whether I overlooked an important piece of information or whether it is a bug. When I create my PShape and set it a stroke color, it is completely ignored when using P2D and I cannot find a way to change that color in any way.

This is how I create my shape

    PShape pshape = createShape();
    pshape.beginShape();
    
    for (Edge e : mc.orderedEdges) {
      pshape.vertex(e.A.x, e.A.y);
    }

    pshape.noFill();
    pshape.stroke(255);
    pshape.strokeWeight(0.2);
    pshape.endShape();

When I then display it using shape(pshape) with setup(2000, 1000), the shape is drawn in white stroke, but if I run the program with setup(2000, 1000, P2D), it is black. And even if I comment out the assignment of the stroke to the pshape and just set the stroke to white before calling shape(pshape), it doesn’t work.

To be honest, I am constantly confused about what works with P2D and what doesn’t, concerning PShapes.

If anyone can help me understand, I would be grateful :wink:

  • -a- it can help if you show a working code

  • -b- for “error” reporting pls give info for your working environment

  • -c- for your question about renderer:
    i try

  size (200, 200);   // test also P2D P3D  same

no difference.

// https://discourse.processing.org/t/why-cant-i-set-pshapes-stroke-with-p2d/7859

// test shape Raspberry Pi 3B+, 
// OS: Raspbian,
// Processing IDE 3.5.2,

PShape myshape;
boolean myfill= false, mystroke=false;

void setup() {
  size (200, 200);   // test also P2D P3D  same
  make_myshape();
  println("use: key [m][s][f]");
}

void make_myshape() {
  myshape = createShape();
  myshape.beginShape();
  myshape.fill(0, 200, 0);
  myshape.stroke(200, 0, 0);
  myshape.strokeWeight(3);    
  for (int i =0; i<3; i++)  myshape.vertex(random(-100,100), random(-100,100));
  myshape.endShape(CLOSE);
}

void draw() {
  background(200, 200, 0);
  shape(myshape, width/2, height/2);
}

void keyPressed() {
  if ( key == 'm' ) make_myshape(); 
  if ( key == 's' ) { 
    mystroke = ! mystroke;
    if ( mystroke ) myshape.setStroke(color(200, 200, 200));
    else            myshape.setStroke(color(0, 200, 200));
  }
  if ( key == 'f' ) {
    myfill   = ! myfill;
    if ( myfill )   myshape.setFill(color(0, 0, 200));
    else            myshape.setFill(color(200, 0, 200));
  }
}

If i‘m not mistaken, then you can‘t set strokeWeight with a float… at least for P2D… might be because P2D prioritises speed over graphics.

  myshape.strokeWeight(3.5);    // test LEXYTH

works for all 3 renderer

but 0.2 might be nearly invisible until you use

  noSmooth();

in setup()

so possibly the question is not

Why can’t i set

more

Why can’t i see