Skip to content

rounded rectangle performance in P2D / P3D is extremely poor when stroke is used #1566

Description

@clankill3r
Image

MacBook Air M3
Processing 4.5.6 (but also older versions apply)

This runs at around 8.5 fps.

void setup() {
  size(800, 800, P2D);
  frameRate(999);
}

void draw() {
  background(0);

  int cols = 16;
  int rows = 16;
  float margin = 50;
  float gap = 10;

  float rectW = (width - margin * 2 - gap * (cols - 1)) / cols;
  float rectH = (height - margin * 2 - gap * (rows - 1)) / rows;

  fill(255, 220, 0);
  stroke(255);
  strokeWeight(2);
  
  for (int y = 0; y < rows; y++) {
    for (int x = 0; x < cols; x++) {
      float px = margin + x * (rectW + gap);
      float py = margin + y * (rectH + gap);

      rect(px, py, rectW, rectH, 10);
    }
  }

  println(frameRate);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions