I have this in my code in the main loop(2D game in a window):
try{
synchronized(this){
wait(3);
}
}
catch(Exception ex) {
System.out.println(ex);
}
This piece of code causes to FPS to cap at 64 and I don't know why. I don't use any other synchronized blocks. Amusingly, when the web browser is open, the fps is no longer capped. Could anybody tell me how to get rid of that 64 fps limit? I didn't manage to find any other topics with this problem.
EDIT:
How could the browser change fps?
Although the resolution of the parameters of wait
and sleep
are in milliseconds you will almost certainly never get exactly the delay you are requesting.
On a Windows system the resolution is approximately 15ms giving 1000/15 = 66fps