fixed bugs

This commit is contained in:
Mitchell Hashimoto
2022-10-29 09:48:57 -07:00
parent 6d0b8a24d9
commit f89b5d12f6
3 changed files with 9 additions and 13 deletions

6
flake.lock generated
View File

@ -109,11 +109,11 @@
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1666872658, "lastModified": 1667045313,
"narHash": "sha256-o7bZWBdkoCnpN4E0tJZ3mOYJFy0AG4HoSqOfdnQLiw4=", "narHash": "sha256-vKrdqq66EF35cjArFQfKmXXPdft+3BiNyjDoR9boYLo=",
"owner": "mitchellh", "owner": "mitchellh",
"repo": "zig-overlay", "repo": "zig-overlay",
"rev": "22bdb1d6b2e313acf185a2f43bd39c5c25f369ae", "rev": "0c9b9364efc23e3765601a583f963e704cc8a919",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -35,14 +35,10 @@ pub fn unload() void {
context = undefined; context = undefined;
} }
pub fn versionMajor(res: c_int) c_uint { pub fn versionMajor(res: c_uint) c_uint {
// https://github.com/ziglang/zig/issues/13162 return c.GLAD_VERSION_MAJOR(res);
// return c.GLAD_VERSION_MAJOR(res);
return @intCast(c_uint, @divTrunc(res, 10000));
} }
pub fn versionMinor(res: c_int) c_uint { pub fn versionMinor(res: c_uint) c_uint {
// https://github.com/ziglang/zig/issues/13162 return c.GLAD_VERSION_MINOR(res);
// return c.GLAD_VERSION_MINOR(res);
return @intCast(c_uint, @mod(res, 10000));
} }

View File

@ -430,8 +430,8 @@ pub fn threadEnter(self: *const OpenGL, window: glfw.Window) !void {
}); });
errdefer gl.glad.unload(); errdefer gl.glad.unload();
log.info("loaded OpenGL {}.{}", .{ log.info("loaded OpenGL {}.{}", .{
gl.glad.versionMajor(version), gl.glad.versionMajor(@intCast(c_uint, version)),
gl.glad.versionMinor(version), gl.glad.versionMinor(@intCast(c_uint, version)),
}); });
} }