init gtk app

This commit is contained in:
Mitchell Hashimoto
2023-02-21 08:20:13 -08:00
parent 48c9c65915
commit f268f3955e
5 changed files with 110 additions and 15 deletions

View File

@@ -444,6 +444,7 @@ pub fn threadEnter(self: *const OpenGL, win: apprt.runtime.Window) !void {
/// Callback called by renderer.Thread when it exits.
pub fn threadExit(self: *const OpenGL) void {
_ = self;
if (apprt.runtime == apprt.gtk) @panic("TODO");
gl.glad.unload();
glfw.makeContextCurrent(null);
@@ -569,12 +570,14 @@ pub fn render(
// Build our devmode draw data
const devmode_data = devmode_data: {
if (state.devmode) |dm| {
if (dm.visible) {
imgui.ImplOpenGL3.newFrame();
imgui.ImplGlfw.newFrame();
try dm.update();
break :devmode_data try dm.render();
if (DevMode.enabled) {
if (state.devmode) |dm| {
if (dm.visible) {
imgui.ImplOpenGL3.newFrame();
imgui.ImplGlfw.newFrame();
try dm.update();
break :devmode_data try dm.render();
}
}
}
@@ -639,11 +642,14 @@ pub fn render(
try self.draw();
// If we have devmode, then render that
if (critical.devmode_data) |data| {
imgui.ImplOpenGL3.renderDrawData(data);
if (DevMode.enabled) {
if (critical.devmode_data) |data| {
imgui.ImplOpenGL3.renderDrawData(data);
}
}
// Swap our window buffers
if (apprt.runtime == apprt.gtk) @panic("TODO");
win.window.swapBuffers();
}