I am trying to set FrameRate using the framerate() function but it is not working, the actual framerate while running the code ranges between 1.8 - 4 fps , here is my setup code:
void setup (){
System.out.println("displayHeight : "+displayHeight);
System.out.println("displayWidth : "+displayWidth);
setBG("white-frame.png");
surface.setLocation(displayWidth/2-width/2, 0);
surface.hideCursor() ;
frameRate(frame_rate); // redraw 10 times in a second, refresh rate is 200 ms/frame
//System.out.println("mapping sections List: "+Arrays.deepToString(pm.getMappingSections()));
// Load the font
f = createFont("font.ttf",150,true);
textFont(f);
file = new SoundFile(this, "Musica.mp3");
file.play();
}
At 10 frames a second that allows a maximum of 100ms to render a frame??? If you expect the draw() method to take 200ms pef frame then the best frame rate you can get is ~5fps no matter what you put in frameRate(?).
Difficult to say more about this because we can’t the value you store in frame_rate and we can’t see how much work you expect to do in the draw() method.
redraw 10 times in a second, refresh rate is 200 ms/frame
This is an old comment, the actual value of frame_rate is 100 but anyway, as I said before the execution frame rate is very low and is not affected by the value stored in frame_rate .
Regarding the other point, in the draw() function I draw images and shapes according to some values stored in a database table, the only heavy work here is the calls to the database server (in the testing process is the same machine).