fps limit
This commit is contained in:
@ -125,7 +125,7 @@ let () =
|
||||
in
|
||||
|
||||
F.pr "oplevel.ml: entering drawing loop@.";
|
||||
|
||||
let period_min = 1.0 /. 30. in
|
||||
let t = GLFW.getTime () |> ref in
|
||||
while (not GLFW.(windowShouldClose ~window)) && !continue do
|
||||
Lwt_main.run
|
||||
@ -166,6 +166,8 @@ let () =
|
||||
Gc.major_slice 0 |> ignore;
|
||||
GLFW.swapBuffers ~window;
|
||||
GLFW.pollEvents ();
|
||||
Unix.sleepf
|
||||
Float.(max 0. (period_min -. GLFW.getTime () +. !t));
|
||||
Lwt.return_unit)
|
||||
())
|
||||
done;
|
||||
|
||||
Reference in New Issue
Block a user