From 00821f25201f92623faf270e890d239f3451076f Mon Sep 17 00:00:00 2001 From: JamesWrigley Date: Sat, 3 Aug 2024 11:28:04 +0200 Subject: [PATCH 1/4] Add some more features to the Makie example --- examples/makie_demo.jl | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/examples/makie_demo.jl b/examples/makie_demo.jl index 5d51682..ed4035a 100644 --- a/examples/makie_demo.jl +++ b/examples/makie_demo.jl @@ -11,17 +11,19 @@ ig.set_backend(:GlfwOpenGL3) function generate_data(type::Symbol=:random, N=1000) if type === :random [Point2f(i, rand()) for i in 1:N] + elseif type === :sine + [Point2f(i, sin(i * 0.1) + 0.5) for i in 1:N] end end function HelpMarker(msg) - ig.TextDisabled("(?)"); + ig.TextDisabled("(?)") if ig.IsItemHovered() && ig.BeginTooltip() - ig.PushTextWrapPos(ig.GetFontSize() * 35.0); - ig.TextUnformatted(msg); - ig.PopTextWrapPos(); - ig.EndTooltip(); + ig.PushTextWrapPos(ig.GetFontSize() * 35.0) + ig.TextUnformatted(msg) + ig.PopTextWrapPos() + ig.EndTooltip() end end @@ -31,8 +33,11 @@ function makie_demo(; engine=nothing) scene = Makie.get_scene(f) ax1 = Axis(f[1, 1]; title="Random data") data = Observable(generate_data()) - lines!(ax1, data) + lines!(ax1, data, label="Random data") + lines!(ax1, generate_data(:sine), label="Sin") data2 = Observable(generate_data()) + axislegend(ax1) + ax2 = Axis(f[2, 1]) lines!(ax2, data2) @@ -44,6 +49,7 @@ function makie_demo(; engine=nothing) ax1_tight_spacing = true auto_resize_x = true auto_resize_y = false + tooltip = true # Start the GUI ig.render(ctx; engine, window_size=(1280, 760), window_title="ImGui Window") do @@ -63,8 +69,10 @@ function makie_demo(; engine=nothing) @c ig.Checkbox("Auto resize X", &auto_resize_x) ig.SameLine() @c ig.Checkbox("Auto resize Y", &auto_resize_y) + ig.SameLine() + @c ig.Checkbox("Draw tooltip", &tooltip) - if ig.MakieFigure("plot", f; auto_resize_x, auto_resize_y) + if ig.MakieFigure("plot", f; auto_resize_x, auto_resize_y, tooltip) if ax1_tight_spacing Makie.tight_ticklabel_spacing!(ax1) end From 61f69d8308c7674d9abff90cd08c3b6880a06e94 Mon Sep 17 00:00:00 2001 From: JamesWrigley Date: Sun, 4 Aug 2024 10:40:03 +0200 Subject: [PATCH 2/4] Document that OpenGL 3.3 is required for Makie --- examples/makie_demo.jl | 2 +- src/CImGui.jl | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/makie_demo.jl b/examples/makie_demo.jl index ed4035a..9129007 100644 --- a/examples/makie_demo.jl +++ b/examples/makie_demo.jl @@ -52,7 +52,7 @@ function makie_demo(; engine=nothing) tooltip = true # Start the GUI - ig.render(ctx; engine, window_size=(1280, 760), window_title="ImGui Window") do + ig.render(ctx; engine, window_size=(1280, 760), window_title="ImGui Window", opengl_version=v"3.3") do ig.Begin("Makie demo") if ig.Button("Random data") diff --git a/src/CImGui.jl b/src/CImGui.jl index cb89db4..562d9e7 100644 --- a/src/CImGui.jl +++ b/src/CImGui.jl @@ -68,7 +68,9 @@ const IMGUI_VERSION = unsafe_string(GetVersion()) # This is implemented by the MakieIntegration extension but we document it here # so that we don't have to install GLMakie to build the docs. """ - MakieFigure(id::String, f::GLMakie.Figure; auto_resize_x=true, auto_resize_y=false, tooltip=true) + MakieFigure(id::String, f::GLMakie.Figure; + auto_resize_x=true, auto_resize_y=false, + tooltip=true) Display a Makie figure in ImGui. See `examples/makie_demo.jl` for an example of how to use it. This supports all the interaction features in GLMakie: @@ -104,6 +106,11 @@ Known issues: - Drawing can be a bit janky, occasionally the image will not be drawn for a frame or two and you'll see an empty black square instead. +!!! note + GLMakie requires OpenGL 3.3, on some systems you will need to explicitly + pass `opengl_version=v"3.3"` (or higher) to [`render()`](@ref) to fix OpenGL + shader errors. + !!! warning This is very experimental, you will almost definitely encounter bugs (and if so please submit an issue/PR). We don't consider this covered under semver From fbeb4009439f49a1187ac84d2405e2b7c7f607d5 Mon Sep 17 00:00:00 2001 From: JamesWrigley Date: Sun, 4 Aug 2024 10:42:25 +0200 Subject: [PATCH 3/4] Document which ImGui version the docs were built against --- docs/src/index.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/src/index.md b/docs/src/index.md index 10a089d..0bfaa76 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -7,6 +7,12 @@ content creation tools and visualization / debug tools. You could browse [Gallery](https://github.com/ocornut/imgui/issues/2265) to get an idea of its use cases. +These docs were generated against this upstream Dear ImGui version: +```@repl +import CImGui as ig +ig.imgui_version() +``` + ## Installation ```julia-repl pkg> add CImGui From 3f18de00b27b33189632bca0ef3b1a26e4f38487 Mon Sep 17 00:00:00 2001 From: JamesWrigley Date: Sun, 4 Aug 2024 10:48:45 +0200 Subject: [PATCH 4/4] Restrict push CI triggers to tags and pushes to master Otherwise it's a bit wasteful to run CI twice for PRs. --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28b7b45..ae1576e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,11 @@ name: CI on: - - push - pull_request + push: + branches: + - master + tags: "*" permissions: actions: write