processing4
processing4 copied to clipboard
performance breakpoint with strokeWeight >= 2.0 in P2D
The difference between scale(1.999999); and scale(2); in the sketch below is that with scale(2); there is a frameRate drop of around 50fps!
- This is only in
P2D(to be extra clear, so not inP3D!). - It breaks with all values that are bigger or equal to 2.
void setup() {
size(600, 600, P2D);
}
void draw() {
background(0);
pushMatrix();
//scale(1.999999);
scale(2);
draw_recursive(50, 50, width-50, height-50, 0, 7);
popMatrix();
fill(255);
text(""+(int)frameRate, 10, 14);
}
void draw_recursive(float x1, float y1, float x2, float y2, int level, int max_level) {
if (level < max_level) {
float cx = x1 + (x2 - x1) / 2;
float cy = y1 + (y2 - y1) / 2;
draw_recursive(x1, y1, cx, cy, level+1, max_level);
draw_recursive(cx, y1, x2, cy, level+1, max_level);
draw_recursive(x1, cy, cx, y2, level+1, max_level);
draw_recursive(cx, cy, x2, y2, level+1, max_level);
} else {
fill(255, 255, 0);
stroke(0);
strokeWeight(1);
rectMode(CORNERS);
rect(x1, y1, x2, y2);
}
}