The table rate per second (FPS or QPS) may be calculated as follows::
public void start() {
lastFPS = getTime();
}
public void updateFPS() {
if (getTime() - lastFPS > 1000) {
Display.setTitle("FPS: " + fps);
fps = 0; //reseta o contador de FPS
lastFPS += 1000; //adiciona um segundo
}
fps++;
}
The representation of FPS is simple, it’s how many frames were displayed in a single second. The frame rate per second being 30, means that in a second 30 frames were displayed.
The formula, in a basic representation, would be: FPS = (number of frames) / (number of seconds). For example, if in
120 seconds were displayed 6400 frames, our FPS would be 53.333 (6400 / 120).
The Display.setTitle(String title)
is to simplify by showing the counter in the window title.
More information on documentation.
Does this resolve https://tutorialedge.net/lwjgl-3-fps-main-game-loop ? I will not formulate an answer because I do not understand of lwjgl, but if you test yourself can answer your own question :)
– Guilherme Nascimento
Search something called Simple Moving Average - SMA. According to OANDA: "SMA means simple Moving Average (simple moving average). Helps smooth the price curve for a better identification of the trend. The longer the selected SMA period, the smoother the curve". Obviously, exchange "prices" there for "frames per second". : ) I also will not put an answer for the same reason William.
– Rasshu
@Guilhermenascimento was what I was looking for, because I only found tutorials on lwjgl 2.
– Vinicius Fernandes