Framerate going down unexpectedly

Hello,

I tried it with this:

And modified:

int noOfPoints = 250;
void draw() {
  surface.setTitle("FrameRate: " + frameRate); //Set the frame title to the frame rate`
  public void show() {
    stroke(255, 50);
    strokeWeight(2);
    point(pos.x, pos.y);
    fill(155, 0, 0);
    float tmp2 = map(pos.x, 0, width, 5, 20);
    //println(pos.x);
    //println(frameRate);
    textSize(int(tmp2));
    text("X", pos.x, pos.y);
  }

I cast the textSize to an int and frame rates were 60 fps.
Otherwise, they slowed down significantly; you can try this.

https://processing.org/reference/textSize_.html
accepts floats but also state that textSize is in units of pixels so casting to an int would provide pixel sizes.

:slight_smile:

3 Likes