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"
},
"locked": {
"lastModified": 1666872658,
"narHash": "sha256-o7bZWBdkoCnpN4E0tJZ3mOYJFy0AG4HoSqOfdnQLiw4=",
"lastModified": 1667045313,
"narHash": "sha256-vKrdqq66EF35cjArFQfKmXXPdft+3BiNyjDoR9boYLo=",
"owner": "mitchellh",
"repo": "zig-overlay",
"rev": "22bdb1d6b2e313acf185a2f43bd39c5c25f369ae",
"rev": "0c9b9364efc23e3765601a583f963e704cc8a919",
"type": "github"
},
"original": {

View File

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

View File

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