Problems with framerate and loading pictures

regarding your example, what is much shorter now,
but still not PASTE into

</> code tag

pls. repair that in your above post!


as you removed the text output, how did the frameRate change?
also make more tests ( to get a feeling what is COSTLY )

  • not use fullscreen
  • use image only with 3 parameter , not 5
    the image resize 60 times per sec is the wrong way.
    resize them in setup?? and in draw just show them
image(img,x,y);

here my test with fps log regarding

  • full screen or 800,800
  • image resize or not
// https://discourse.processing.org/t/problems-with-framerate-and-loading-pictures/9670

PImage img1, img2;

void setup() {
  //fullScreen();
  size(800,800);
  img1=loadImage("moonwalk.jpg");
  img2=loadImage("moonwalk.jpg");
}

void draw() {
  background(0);
  if (frameCount< 420) image(img1, width/2, 40, width/2, height/2);  //full: 6 fps  // 12fps
  if (frameCount==420) println("not use image resize");
  if (frameCount> 420) image(img2, width/2, 300);                    //full: 12 fps // 36fps
  fill(255);
  text(nf(frameRate,1,1)+" fps",width-100,20);
}

this test ‘here’ ( on my 40$ computer ) shows extreme values,
but good for learning.

as if we use your example code only,
what shows one picture, and later a other, the FPS

does not make any difference

or you complain?

with the low and varying fps the timing of your code not work as planned?

well, not forget that we show you some time ago better ways to build a timer
( what use millis() and not frameCount )
Help with delay/millis without influencing the framerate - #2 by kll !

1 Like