From a4cf3c65813108bb844e774dc3919786c4cdbe46 Mon Sep 17 00:00:00 2001 From: Dendy Date: Fri, 29 Jul 2022 09:03:16 +0200 Subject: [PATCH] Deactivate VSync with err handling, fix framerate --- src/Renderer.zig | 3 +++ src/main.zig | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Renderer.zig b/src/Renderer.zig index 17f5e82..4dd756e 100644 --- a/src/Renderer.zig +++ b/src/Renderer.zig @@ -31,6 +31,9 @@ pub fn init() !Self { ); const ctx = try sdl.gl.createContext(window); + sdl.gl.setSwapInterval( .immediate ) catch { + std.debug.print("WARNING: Unable to configure the swap interval.\n", .{}); + }; var mvp_loc: u32 = undefined; var color_loc: u32 = undefined; diff --git a/src/main.zig b/src/main.zig index bb30e58..330c235 100644 --- a/src/main.zig +++ b/src/main.zig @@ -38,8 +38,8 @@ pub fn main() !void { const delay = SDL.getTicks64() - start; std.debug.print("{} ms\n", .{delay}); - if (delay < 15) { - SDL.delay(15 - @intCast(u32, delay)); + if (delay < 16) { + SDL.delay(16 - @intCast(u32, delay)); } } }