From 0fca3d34a56a420da92a7cb20109e71d523f7bf6 Mon Sep 17 00:00:00 2001 From: Leah Amelia Chen Date: Thu, 17 Sep 2026 23:35:11 +0800 Subject: [PATCH] gtk/imgui_widget: remove direct call to glClearColor Since the refactor to move our OpenGL context off-thread there is no more GLAD context loaded on the main thread for this widget, so calling ANY OpenGL function will crash the entire app. I don't think the call even worked as intended? I at least can't seem to tell any difference when the clear commands are simply removed. Maybe they were useful before. --- passthrough.glsl | 4 ++++ src/apprt/gtk/class/imgui_widget.zig | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 passthrough.glsl diff --git a/passthrough.glsl b/passthrough.glsl new file mode 100644 index 000000000..1102f4559 --- /dev/null +++ b/passthrough.glsl @@ -0,0 +1,4 @@ +void mainImage(out vec4 fragColor, in vec2 fragCoord) { + vec2 uv = fragCoord / iResolution.xy; + fragColor = vec4(texture(iChannel0, uv).rgb, 1.0); +} diff --git a/src/apprt/gtk/class/imgui_widget.zig b/src/apprt/gtk/class/imgui_widget.zig index 50247fbf1..7961d7a83 100644 --- a/src/apprt/gtk/class/imgui_widget.zig +++ b/src/apprt/gtk/class/imgui_widget.zig @@ -317,9 +317,6 @@ pub const ImguiWidget = extern struct { cimgui.c.ImGui_Render(); } - // OpenGL final render - gl.clearColor(0x28 / 0xFF, 0x2C / 0xFF, 0x34 / 0xFF, 1.0); - gl.clear(gl.c.GL_COLOR_BUFFER_BIT); cimgui.ImGui_ImplOpenGL3_RenderDrawData(cimgui.c.ImGui_GetDrawData()); return @intFromBool(true);