diff options
Diffstat (limited to 'src/window')
-rw-r--r-- | src/window/window.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/window/window.c b/src/window/window.c index d0c9cc0..00bcf57 100644 --- a/src/window/window.c +++ b/src/window/window.c @@ -487,6 +487,7 @@ static int mgl_window_init(mgl_window *self, const char *title, const mgl_window self->monitors = NULL; self->num_monitors = 0; self->pos = (mgl_vec2i){ 0, 0 }; + self->low_latency = false; mgl_vec2i window_size = params ? params->size : (mgl_vec2i){ 0, 0 }; if(window_size.x <= 0 || window_size.y <= 0) { @@ -1190,8 +1191,10 @@ bool mgl_window_poll_event(mgl_window *self, mgl_event *event) { void mgl_window_display(mgl_window *self) { mgl_context *context = mgl_get_context(); context->gl.glXSwapBuffers(context->connection, self->window); - context->gl.glFlush(); - context->gl.glFinish(); + if(self->low_latency) { + context->gl.glFlush(); + context->gl.glFinish(); + } if(self->frame_time_limit > 0.000001) { double time_left_to_sleep = self->frame_time_limit - mgl_clock_get_elapsed_time_seconds(&self->frame_timer); @@ -1368,6 +1371,14 @@ bool mgl_window_is_fullscreen(const mgl_window *self) { return is_fullscreen; } +void mgl_window_set_low_latency(mgl_window *self, bool low_latency) { + self->low_latency = low_latency; +} + +bool mgl_window_is_low_latency_enabled(const mgl_window *self) { + return self->low_latency; +} + void mgl_window_set_position(mgl_window *self, mgl_vec2i position) { XMoveWindow(mgl_get_context()->connection, self->window, position.x, position.y); } |