Text drawing seems to be happening out of order, compared to a filter(BLUR)

Hello,

The framerate drops significantly with filter(BLUR).

You are doing a rotation about the origin (0, 0) in the corner and won’t see all of the lines.

I was trying to improve performance:

  • I removed the rotate() and used smaller loop iterations.
  • You could extend the random limits beyond the sketch window for a similar effect.

Test code:

String name = "Hello";

void setup()
 {
 size(800, 800, P2D);
 textSize(48);
 }

void draw()
  {
  background(0);
  drawIt();
  println(frameRate);
  }

void drawIt() {
    background(0);
    strokeWeight(4);

    pushMatrix();
    for (int j=0; j<10; j++) 
      { 
      for (int i=0; i<10; i++) 
        {
        fill(150, random(200), 30);
        stroke(150, random(200), 30);
        line(random(width), random(height), random(width), random(height));
        }
      filter(BLUR);
      //rotate(j*0.4);
      }
    popMatrix();
    fill(255, 255, 255, 255);
    stroke(255, 255, 255, 255);
    //textSize(48);
    text(name, 40, 100);    
    //saveFrame("background.png");
  }

The loading of this loop and resulting slow frameRate should be considered.

Try it commenting the filter(BLUR) and see what happens.

I don’t think this is related but sharing nonetheless:

:)

1 Like