diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2019-10-20 21:32:16 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2019-10-20 21:32:16 +0000 |
| commit | 82c6a2bdb47185368b44b31e85d7ec68862d081f (patch) | |
| tree | 328a28fb6eb5121c7f6d70a57dfc933e6e125456 /src/main.zig | |
| parent | finish GLFW impl (diff) | |
| download | zig-imgui-82c6a2bdb47185368b44b31e85d7ec68862d081f.tar.gz zig-imgui-82c6a2bdb47185368b44b31e85d7ec68862d081f.zip | |
add openGL3 impl (still failing)
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main.zig b/src/main.zig index 08f5bea..59b1804 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2,6 +2,7 @@ const c = @import("c.zig"); const std = @import("std"); const panic = std.debug.panic; const glfw_impl = @import("glfw_impl.zig"); +const gl3_impl = @import("gl3_impl.zig"); extern fn errorCallback(err: c_int, description: [*c]const u8) void { panic("Error: {}\n", description); @@ -9,7 +10,7 @@ extern fn errorCallback(err: c_int, description: [*c]const u8) void { var window: *c.GLFWwindow = undefined; -pub fn main() void { +pub fn main() !void { _ = c.glfwSetErrorCallback(errorCallback); if (c.glfwInit() == c.GL_FALSE) { @@ -42,8 +43,8 @@ pub fn main() void { const io = c.igGetIO(); io.*.ConfigFlags |= @enumToInt(c.ImGuiConfigFlags_NavEnableKeyboard); - io.*.ConfigFlags |= @enumToInt(c.ImGuiConfigFlags_DockingEnable); - io.*.ConfigFlags |= @enumToInt(c.ImGuiConfigFlags_ViewportsEnable); + // io.*.ConfigFlags |= @enumToInt(c.ImGuiConfigFlags_DockingEnable); + // io.*.ConfigFlags |= @enumToInt(c.ImGuiConfigFlags_ViewportsEnable); const style = c.igGetStyle(); c.igStyleColorsDark(style); @@ -56,7 +57,8 @@ pub fn main() void { glfw_impl.Init(window, true, glfw_impl.ClientApi.OpenGL); defer glfw_impl.Shutdown(); - // ImGui_ImplOpenGL3_Init(glsl_version); + gl3_impl.Init(); // #version 150 + defer gl3_impl.Shutdown(); const start_time = c.glfwGetTime(); var prev_time = start_time; @@ -64,8 +66,8 @@ pub fn main() void { while (c.glfwWindowShouldClose(window) == c.GL_FALSE) { c.glfwPollEvents(); + try gl3_impl.NewFrame(); glfw_impl.NewFrame(); - // gl3_impl.NewFrame(); c.igNewFrame(); // main part @@ -78,7 +80,7 @@ pub fn main() void { c.glViewport(0, 0, w, h); c.glClearColor(0.0, 0.0, 0.0, 0.0); c.glClear(c.GL_COLOR_BUFFER_BIT); - // gl3_impl.RenderDrawData(c.igGetDrawData()); + gl3_impl.RenderDrawData(c.igGetDrawData()); // const now_time = c.glfwGetTime(); // const elapsed = now_time - prev_time; |
