enable vsync in rgfw shell, to majorly decrease cpu usage
This commit is contained in:
@@ -30,6 +30,11 @@ void swapBuffers(RGFW_window* window) {
|
|||||||
RGFW_window_swapBuffers_OpenGL(window);
|
RGFW_window_swapBuffers_OpenGL(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void enableVsync(RGFW_window* window) {
|
||||||
|
// A swap interval of 1 will enable vsync
|
||||||
|
RGFW_window_swapInterval_OpenGL(window, 1);
|
||||||
|
}
|
||||||
|
|
||||||
void writeClipboard(char* string, int stringSize) {
|
void writeClipboard(char* string, int stringSize) {
|
||||||
RGFW_writeClipboard(string, stringSize);
|
RGFW_writeClipboard(string, stringSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ struct
|
|||||||
_import "shouldCloseWindow" public : window -> bool;
|
_import "shouldCloseWindow" public : window -> bool;
|
||||||
val swapBuffers =
|
val swapBuffers =
|
||||||
_import "swapBuffers" public : window -> unit;
|
_import "swapBuffers" public : window -> unit;
|
||||||
|
val enableVsync =
|
||||||
|
_import "enableVsync" public : window -> unit;
|
||||||
val pollEvents =
|
val pollEvents =
|
||||||
_import "pollEvents" public reentrant : unit -> unit;
|
_import "pollEvents" public reentrant : unit -> unit;
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ struct
|
|||||||
fun main () =
|
fun main () =
|
||||||
let
|
let
|
||||||
val window = Rgfw.createWindow ("shf", 0, 0, 1920, 1080)
|
val window = Rgfw.createWindow ("shf", 0, 0, 1920, 1080)
|
||||||
|
val () = Rgfw.enableVsync window
|
||||||
val () = Gles3.enableDepthTest ()
|
val () = Gles3.enableDepthTest ()
|
||||||
|
|
||||||
(* load file intol gap buffer and create initial app *)
|
(* load file intol gap buffer and create initial app *)
|
||||||
|
|||||||
Reference in New Issue
Block a user