Deactivate VSync with err handling, fix framerate

This commit is contained in:
Dendy 2022-07-29 09:03:16 +02:00
parent e4f7fca02d
commit a4cf3c6581
2 changed files with 5 additions and 2 deletions

View File

@ -31,6 +31,9 @@ pub fn init() !Self {
); );
const ctx = try sdl.gl.createContext(window); 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 mvp_loc: u32 = undefined;
var color_loc: u32 = undefined; var color_loc: u32 = undefined;

View File

@ -38,8 +38,8 @@ pub fn main() !void {
const delay = SDL.getTicks64() - start; const delay = SDL.getTicks64() - start;
std.debug.print("{} ms\n", .{delay}); std.debug.print("{} ms\n", .{delay});
if (delay < 15) { if (delay < 16) {
SDL.delay(15 - @intCast(u32, delay)); SDL.delay(16 - @intCast(u32, delay));
} }
} }
} }