Deactivate VSync with err handling, fix framerate
This commit is contained in:
parent
e4f7fca02d
commit
a4cf3c6581
|
@ -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;
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue