gnimuc / cimgui.jl Goto Github PK
View Code? Open in Web Editor NEWJulia wrapper for cimgui
Home Page: https://github.com/cimgui/cimgui
License: MIT License
Julia wrapper for cimgui
Home Page: https://github.com/cimgui/cimgui
License: MIT License
I have a package that uses CImGui that I'd like to compile down to a sysimage, so I've been trying out PackageCompilerX, but it's having difficulties with CImGui, so I've given compiling CImGui alone a go.
I have the scripts setup to load the demo at examples/demo.jl
, which I manually interact with once loaded, to allow PackageCompilerX to generate the precompile statements. https://github.com/ianshmean/CImGui.jl/tree/attempt_compile/dev/compilation
The process succeeds but with various precompile statement execution failures.
[ Info: PackageCompilerX: creating system image object file, this might take a while...
┌ Error: failed to execute precompile(Tuple{Type{Base.Generator{I, F} where F where I}, getfield(Main, Symbol("#17#18")), Base.UnitRange{Int64}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{getfield(Main, Symbol("#7#10")), Int64})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{getfield(Main, Symbol("#ItemGetter#23")), Ptr{Ptr{Int8}}, Int32, Ptr{Ptr{Int8}}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{getfield(Main, Symbol("#Saw#25")), Ptr{Nothing}, Int32})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{getfield(Main, Symbol("#Sin#24")), Ptr{Nothing}, Int32})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{getfield(Main, Symbol("#Square#14")), Ptr{CImGui.LibCImGui.ImGuiSizeCallbackData}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{getfield(Main, Symbol("#Step#15")), Ptr{CImGui.LibCImGui.ImGuiSizeCallbackData}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Base.collect), Base.Generator{Base.UnitRange{Int64}, getfield(Main, Symbol("#17#18"))}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowAboutWindow), Base.RefValue{Bool}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowDemoWindow), Base.RefValue{Bool}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowDemoWindowColumns)})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowDemoWindowLayout)})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowDemoWindowMisc)})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowDemoWindowPopups)})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowDemoWindowWidgets)})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowDummyObject), String, Int64})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowExampleAppAutoResize), Base.RefValue{Bool}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowExampleAppConstrainedResize), Base.RefValue{Bool}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowExampleAppCustomRendering), Base.RefValue{Bool}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowExampleAppLayout), Base.RefValue{Bool}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowExampleAppLongText), Base.RefValue{Bool}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowExampleAppMainMenuBar), Base.RefValue{Bool}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowExampleAppPropertyEditor), Base.RefValue{Bool}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowExampleAppSimpleOverlay), Base.RefValue{Bool}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowExampleAppWindowTitles), Base.RefValue{Bool}})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowExampleMenuFile)})
└ @ Main.anonymous none:23
┌ Error: failed to execute precompile(Tuple{typeof(Main.ShowHelpMarker), String})
└ @ Main.anonymous none:23
The sysmimage however does begin to work, but the resulting window has graphical bugs.
i.e.
sh -c "julia-1.3 -J/home/ian/Documents/GitHub/CImGui.jl/dev/compilation/CImGuiSysImage.so -q -e '@show isdefined(Main, :CImGui); include(joinpath(dirname(dirname(pathof(CImGui))), \"examples\", \"demo.jl\"))' -i"
when it should look like
I assume this hasn't been tried before, given how new PackageCompilerX is, but I was wondering if anyone has any ideas? @Gnimuc @KristofferC ?
It's mentioned in the readme that SDL support could be added. Do we think that will happen any time soon if at all? Thanks.
Hitting the limitation mentioned here: epezent/implot#30
Demo to reproduce here: https://github.com/wsphillips/CImPlot.jl/blob/master/demo/demo.jl
This attempts to plot 100k points, but can only display 16k at a time.
Issue raised because (supposedly) this is fixed within imgui itself (from discussion above):
If you plan to render several thousands lines or points, then you should consider enabling 32-bit indices by uncommenting #define ImDrawIdx unsigned int in your imconfig.h file, OR handling the ImGuiBackendFlags_RendererHasVtxOffset flag in your renderer (the official OpenGL3 renderer supports this). If you fail to do this, then you may at some point hit the maximum number of indices that can be rendered.
In the CImGui.jl
OpenGL backend RendererHasVtxOffset
seems to be set, so I'm not sure why it's still truncating...?
It's already rather fast for it and the Plots package based on it. What's possible:
$ julia -O1 --compile=min -q
julia> @time using CImGui
0.510211 seconds (598.01 k allocations: 42.734 MiB)
vs. on defaults
julia> @time using CImGui
1.119417 seconds (705.33 k allocations: 48.456 MiB, 0.73% gc time)
I'm looking into a PR to get this as a default, I'm just not sure you would want it. At least not with compile-min.
Trying to run demo or examples on master
branch:
using CImGui
include(joinpath(pathof(CImGui), "..", "..", "demo", "demo.jl"))
I get error message:
LoadError: UndefVarError: GLFW not defined
What are correct module names?
Hi, I'm posting this here for now because I can't tell if this is a CImGui issue or ImGui.
I started building an interface when I ran into bug where having a CollapsingHeader
and InputText
that both have the same label. It took me a while to narrow done the issue. If I have two collapsing headers, for example:
if CImGui.CollapsingHeader("Global")
returned = CImGui.InputText("Simulation", ...) <== InputText has same label as Header below
end
if CImGui.CollapsingHeader("Simulation")
end
Then expanding the Global
header injects a input text field that happens to have the same label as the Simulation
header section. This prevents the Simulation
header from expanding. Once I relabeled the input text to something else then things began working again as expected.
Is this expected behavior? I couldn't find anything in the docs that says you can't have two different widget types with the same label. It seems every widget must have a different (i.e. unique) value.
Thoughts?
I was wondering if it would be somehow possible to catch crash inducing errors on the julia side of things instead of causing crashes in CImgui itself. It's pretty annoying during development to have to restart julia every time. I don't know if it's feasible at all though, if it would be specific checks to every function separately I guess nvm and I should get my stuff together :p
function edit(insbuf::InstrBuffer, addr)
for qt in insbuf.quantities
edit(qt, insbuf.instrnm, addr)
end
end
function edit(qt::InstrQuantity, instrnm, addr, ::Val{:set})
id = string(instrnm, "-", addr, "-", qt.name)
ftsz = CImGui.GetFontSize()
CImGui.Text(qt.alias)
CImGui.SameLine(ftsz*(maxaliaslist[instrnm]/3+0.5))
CImGui.Text(":"); CImGui.SameLine() ###alias
Us = conf["U"][qt.utype]
U = isempty(Us) ? "" : Us[qt.uindex]
CImGui.PushStyleVar(CImGui.ImGuiStyleVar_ItemSpacing, (0, 2))
width = (CImGui.GetContentRegionAvailWidth()-6ftsz)/2
CImGui.PushItemWidth(width)
CImGui.InputTextWithHint("##设置$id", "设置值", qt.set, length(qt.set))
CImGui.PopItemWidth()
CImGui.SameLine() ###设置值
valstr = qt.read
val = U == "" ? valstr : @trypass string(parse(Float64, valstr)/ustrip(upreferred(U), 1U)) valstr
CImGui.PushFont(secondft)
CImGui.Button(string(val, "##$id"), (width, Float32(0)))
CImGui.PopFont()
CImGui.SameLine() ###实际值
CImGui.PushItemWidth(3ftsz)
@c showunit("##insbuf$id", qt.utype, &qt.uindex)
CImGui.PopItemWidth()
CImGui.PopStyleVar()
CImGui.SameLine() ###单位
CImGui.PushStyleVar(CImGui.ImGuiStyleVar_FrameRounding, 6)
if CImGui.Button(" 确认 ##$id")
if addr != ""
svstr = replace(qt.set, r"\0.*"=>"")
sv = U == "" ? svstr : @trypass string(eval(Meta.parse(sv)))*ustrip(upreferred(U), 1U) svstr
instr = INSTR(instrnm, addr)
setfunc = Symbol(instrnm, :_, qt.name, :_set)
getfunc = Symbol(instrnm, :_, qt.name, :_get)
lockstates() do
@trylink_do instr (eval(:($setfunc($instr, $sv))); qt.read = eval(:($getfunc($instr)))) nothing
end
end
end
CImGui.PopStyleVar()
end
I'm guessing this is an upstream change
could not load symbol "igPushStyleColor":
/home/ian/.julia/artifacts/5fdf8d579573e724b2fbe994a29d113ca81b108e/lib/libcimgui.so: undefined symbol: igPushStyleColor
Stacktrace:
[1] igPushStyleColor at /home/ian/.julia/packages/CImGui/OGzct/gen/libcimgui_api.jl:310 [inlined]
[2] PushStyleColor at /home/ian/.julia/packages/CImGui/OGzct/src/wrapper.jl:549 [inlined]
[5d785b6c] CImGui v1.77.0
For now, CImGui_jll
is compiled with IMGUI_DISABLE_OBSOLETE_FUNCTIONS
which means it may break any downstream packages that haven't capped the CImGui
minor version.
#94 reuses the demo code for a test suite but does not expand any sections or interact with elements.
Also there are no visual regression tests. I looked into ways to grab images of the CImGui window but came up short of using ImageMagick to take a screenshot. (unfortunately that functionality isn't exposed by ImageMagick.jl)
I found that when I use ImGuiTextFilter in a package, there are some issues, but it works well when I run codes with "include". Is there any way to solve this problem? I wrote some sample codes and recorded the error message as follows.
Codes inside the rendering loop:
let
filter::Ptr{ImGuiTextFilter} = ImGuiTextFilter_ImGuiTextFilter(C_NULL)
content = ["ajfa;", "qoe;asdjk", "xnm,d", "178250kd", "g078gyu", "awefr23"]
global function filterbug()
CImGui.Begin("TestBugs")
ImGuiTextFilter_Draw(filter, "Filter contents", 16CImGui.GetFontSize())
for s in content
ImGuiTextFilter_PassFilter(filter, pointer(s), C_NULL) || continue
CImGui.Text(s)
end
CImGui.End()
end
end
I wrote it in a package named TestBugs with rendering function UI.
when I run it through:
include("src/TestBugs.jl")
TestBugs.UI()
it works well.
But when I run it through:
using Pkg; Pkg.activate(".")
using TestBugs
UI()
it will produce an error
Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ff983700a01 -- strlen at C:\WINDOWS\System32\msvcrt.dll (unknown line)
in expression starting at none:0
strlen at C:\WINDOWS\System32\msvcrt.dll (unknown line)
_ZN5ImGui11InputTextExEPKcS1_PciRK6ImVec2iPFiP26ImGuiInputTextCallbackDataEPv at C:\Users\22112\.julia\artifacts\332c8d1e20d65e18db01d6e29164ca87a9d83cb0\bin\libcimgui.dll (unknown line)
_ZN5ImGui9InputTextEPKcPcyiPFiP26ImGuiInputTextCallbackDataEPv at C:\Users\22112\.julia\artifacts\332c8d1e20d65e18db01d6e29164ca87a9d83cb0\bin\libcimgui.dll (unknown line)
_ZN15ImGuiTextFilter4DrawEPKcf at C:\Users\22112\.julia\artifacts\332c8d1e20d65e18db01d6e29164ca87a9d83cb0\bin\libcimgui.dll (unknown line)
ImGuiTextFilter_Draw at C:\Users\22112\.julia\packages\LibCImGui\DfBwq\lib\x86_64-w64-mingw32.jl:5027 [inlined]
filterbug at C:\Users\22112\OneDrive - mails.ucas.ac.cn\鏂囨。\CODE\Julia\MyPackages\TestBugs\src\TestBugs.jl:99
macro expansion at C:\Users\22112\OneDrive - mails.ucas.ac.cn\鏂囨。\CODE\Julia\MyPackages\TestBugs\src\TestBugs.jl:57 [inlined]
#1 at .\task.jl:514
unknown function (ip: 0000028cfd649673)
jl_apply at C:/workdir/src\julia.h:1879 [inlined]
start_task at C:/workdir/src\task.c:1092
Allocations: 1947758 (Pool: 1945834; Big: 1924); GC: 3
I have compiled an app using CImGui, but it doesn't show anything in main window:
Compilation script:
julia --project=@. --startup-file=no -e '
using PackageCompiler;
PackageCompiler.create_app(pwd(), "MyProjectCompiled";
cpu_target="generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)",
precompile_execution_file=["test/runtests.jl"])
'
Entrypoint:
function julia_main()::Cint
try
state = AppData()
t = Renderer.render(
()->ui(state),
width=500,
height=500,
title=""
)
wait(t)
catch
Base.invokelatest(Base.display_error, Base.catch_stack())
return 1
end
return 0 # if things finished successfully
end
Any ideas why this can happen?
I'll try to make an MWE for this and link it below.
imgui v1.77 + cimgui v1.77 have at last been tagged.
This latest version of imgui contains internal fixes that pair with the work done on implot to support 16-bit indices ( fixing #22 + improving performance). Very much appreciated if we can get support up for it!
Bummer, this looks nice, but I have no idea how to start.
As the README indicates in the very first paragraph...this is a Julia wrapper of cimgui, which in turn is a C wrapper of the C++ Dear ImGui ...So, what am I to do if I am coming from Julia and have never heard of any of these 3? Do I need to learn Dear ImGui, first; then, cimgui; then, CImGui.jl ?
Also, for installation, it just says to do add CImGui
...is that it? 'cause non of the examples run correctly; nothing visual happens, just get the prompt back. . Any dependencies ?
Hi, I'm new to Julia and not a software engineer, so my apologies in advance if I'm off here. I was trying to debug one of the demo examples for CImGui v1.79.0, specifically
Columns -> Horizontal Scrolling
that causes the GUI to crash and I (cautiously) think I found a simple bug that fixes it and that it hasn't been corrected yet in newer versions. Just a an mixup of self
and handle
in Begin
defined in wrappers.jl
:
# the relevant code is this:
# Begin(handle::Ptr{ImGuiListClipper}, items_count, items_height=-1.0) = ImGuiListClipper_Begin(self, items_count, items_height)
# but should be this:
Begin(handle::Ptr{ImGuiListClipper}, items_count, items_height=-1.0) = ImGuiListClipper_Begin(handle, items_count, items_height)
I'm not familiar with the version control pull request procedure stuff to suggest a code change, but was hoping someone who is could help fix it. Thanks.
As per title,
When precompiling CImGui
the precompilation fails with the error:
ERROR: LoadError: UndefVarError: libcimgui not defined
Stacktrace:
[1] igGET_FLT_MAX()
@ CImGui.LibCImGui ~/.local/julia/packages/CImGui/svEI7/gen/libcimgui_api.jl:3726
[2] top-level scope
@ ~/.local/julia/packages/CImGui/svEI7/src/CImGui.jl:22
[3] include
@ ./Base.jl:419 [inlined]
[4] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
@ Base ./loading.jl:1554
[5] top-level scope
@ stdin:1
libcimgui
is defined for the previous 3725 lines but f**k this line in particular i guess.
I am on an M1 mac. Julia version 1.8.2 aarch64
I dug around a bit, and noticed that there isn't a version of CImGui_jll
available for the aarch64-apple-darwin
platform.
just forgot to add the platform to the artifacts or are there worse issues at play?
Thanks
Ptr
type in 1.82, please use unsafe_load
to explicitly copy the object in your old code base.For example, igGetIO()
returns a pointer of type Ptr{ImGuiIO}
in 1.82.
With this field access method in 1.79, say we have io::Ptr{ImGuiIO}=igGetIO()
, then we can run ds = io.DisplaySize
to get an object ds
of type ImVec2
.
The new field access method generated by Clang.jl now returns a pointer(in the above example, Ptr{ImVec2}
) instead of an object(in the above example, ImVec2
).
We are making this change because we want a small memory footprint and chaining support:
io.DisplaySize.x
will now return a pointer and we can explicitly write unsafe_load(io.DisplaySize.x)
to copy the value. In this case, only the value x
is copied from C to Julia, not the whole object io.DisplaySize
.
In 1.82, it will be a lot easier to read/load/copy a single value from a big nested struct without copying the whole struct object from C to Julia.
Hi, it looks like LibCImGui.jl has some updated code that CImGui is not able to deal with? I got the "KeyPadEnter" error already mentioned by somebody else, and after fixing it in my own code I'm getting "igTreeNodeStr(label)
not defined" when calling TreeNode()
. Because it's been updated to igTreeNode_Str(label)
.
The package versions I'm using are:
I am trying to run the demo, but it fails with the above mentioned error. Based on #88 I set the _jll version to 0.1.2, but it doesn't seem to work.
I'm using julia v1.9.2 on Windows 11, package versions:
(demo) pkg> st
Status `C:\Users\username\git\CImGui.jl\demo\Project.toml`
[5d785b6c] CImGui v1.82.0
[623d79b3] ImGuiGLFWBackend v0.1.2
[9d0819b4] ImGuiOpenGLBackend v0.1.1
⌃ [333409e9] CImGuiPack_jll v0.1.2+0
In a fresh julia session:
julia> using CImGui
julia> include("demo.jl")
ERROR: LoadError: UndefVarError: `ImGuiKey_KeyPadEnter` not defined
Stacktrace:
[1] init(ctx::ImGuiGLFWBackend.Context)
@ ImGuiGLFWBackend C:\Users\username\.julia\packages\ImGuiGLFWBackend\42XtF\src\interface.jl:36
[2] top-level scope
@ C:\Users\username\git\CImGui.jl\demo\demo.jl:62
[3] include(fname::String)
@ Base.MainInclude .\client.jl:478
[4] top-level scope
@ REPL[2]:1
in expression starting at C:\Users\username\git\CImGui.jl\demo\demo.jl:62
I am not sure how to proceed now.
I've ran into this issue while trying demo.jl
all things works super smoothly 😄 thank you for such extensive examples.
┌ Error: Error in renderloop!
│ exception = AssertionError: length(mouse_cursors_names) == CImGui.ImGuiMouseCursor_COUNT
└ @ Main c:\Users\devsisters\.julia\packages\CImGui\Hqms9\examples\demo.jl:105
Stacktrace:
[1] ShowDemoWindowMisc() at c:\Users\devsisters\.julia\packages\CImGui\Hqms9\examples\demo_misc.jl:206
[2] ShowDemoWindow(::Base.RefValue{Bool}) at c:\Users\devsisters\.julia\packages\CImGui\Hqms9\examples\demo_window.jl:239
[3] top-level scope at c:\Users\devsisters\.julia\packages\CImGui\Hqms9\examples\demo.jl:83
[4] include_string(::Module, ::String, ::String) at .\loading.jl:1080
[5] #invokelatest#1 at .\essentials.jl:712 [inlined]
[6] invokelatest at .\essentials.jl:711 [inlined]
[7] inlineeval(::Module, ::String, ::Int64, ::Int64, ::String) at c:\Users\devsisters\.vscode\extensions\julialang.language-julia-0.17.1\scripts\packages\VSCodeServer\src\eval.jl:78
[8] (::VSCodeServer.var"#43#45"{String,Int64,Int64,String,Module,Bool})() at c:\Users\devsisters\.vscode\extensions\julialang.language-julia-0.17.1\scripts\packages\VSCodeServer\src\eval.jl:45
[9] withpath(::VSCodeServer.var"#43#45"{String,Int64,Int64,String,Module,Bool}, ::String) at c:\Users\devsisters\.vscode\extensions\julialang.language-julia-0.17.1\scripts\packages\VSCodeServer\src\repl.jl:113
[10] (::VSCodeServer.var"#42#44"{String,Int64,Int64,String,Module,Bool,Bool})() at c:\Users\devsisters\.vscode\extensions\julialang.language-julia-0.17.1\scripts\packages\VSCodeServer\src\eval.jl:43
[11] hideprompt(::VSCodeServer.var"#42#44"{String,Int64,Int64,String,Module,Bool,Bool}) at c:\Users\devsisters\.vscode\extensions\julialang.language-julia-0.17.1\scripts\packages\VSCodeServer\src\repl.jl:34
[12] repl_runcode_request(::VSCodeServer.JSONRPC.JSONRPCEndpoint, ::VSCodeServer.ReplRunCodeRequestParams) at c:\Users\devsisters\.vscode\extensions\julialang.language-julia-0.17.1\scripts\packages\VSCodeServer\src\eval.jl:23
[13] dispatch_msg(::VSCodeServer.JSONRPC.JSONRPCEndpoint, ::VSCodeServer.JSONRPC.MsgDispatcher, ::Dict{String,Any}) at c:\Users\devsisters\.vscode\extensions\julialang.language-julia-0.17.1\scripts\packages\JSONRPC\src\typed.jl:66
[14] macro expansion at c:\Users\devsisters\.vscode\extensions\julialang.language-julia-0.17.1\scripts\packages\VSCodeServer\src\VSCodeServer.jl:95 [inlined]
[15] (::VSCodeServer.var"#60#62"{Bool,String})() at .\task.jl:358
Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = "C:\Users\devsisters\AppData\Local\Programs\Microsoft VS Code\Code.exe"
JULIA_NUM_THREADS =
Is there a way to use the gr framework (or GRUtils) with CImGui.jl ?
Steps to reproduce:
julia> include(joinpath(pathof(CImGui), "..", "..", "examples", "demo.jl"))
┌ Error: Error in renderloop!
│ exception =
│ MethodError: no method matching Clipper(::Int64)
│ Closest candidates are:
│ Clipper() at /Users/patrick/.julia/packages/CImGui/svEI7/src/wrapper.jl:2972
└ @ Main ~/.julia/packages/CImGui/svEI7/examples/demo.jl:105
Stacktrace:
[1] ShowExampleAppLongText(p_open::Base.RefValue{Bool})
@ Main ~/.julia/packages/CImGui/svEI7/examples/app_long_text.jl:39
[2] ShowDemoWindow(p_open::Base.RefValue{Bool})
@ Main ~/.julia/packages/CImGui/svEI7/examples/demo_window.jl:64
[3] top-level scope
@ ~/.julia/packages/CImGui/svEI7/examples/demo.jl:83
[4] include(fname::String)
@ Base.MainInclude ./client.jl:444
[5] top-level scope
@ REPL[2]:1
[6] eval(m::Module, e::Any)
@ Core ./boot.jl:360
[7] eval_user_input(ast::Any, backend::REPL.REPLBackend)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:139
[8] repl_backend_loop(backend::REPL.REPLBackend)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:200
[9] start_repl_backend(backend::REPL.REPLBackend, consumer::Any)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:185
[10] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:317
[11] run_repl(repl::REPL.AbstractREPL, consumer::Any)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:305
[12] (::Base.var"#878#880"{Bool, Bool, Bool})(REPL::Module)
@ Base ./client.jl:387
[13] #invokelatest#2
@ ./essentials.jl:707 [inlined]
[14] invokelatest
@ ./essentials.jl:706 [inlined]
[15] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
@ Base ./client.jl:372
[16] exec_options(opts::Base.JLOptions)
@ Base ./client.jl:302
[17] _start()
@ Base ./client.jl:485
Hi Gnimuc, thanks so much for this great package!
I noticed in examples/Renderer.jl that render()
takes a hotloading
parameter. That sounds super useful, if it means we can just save a function and instantly the UI updated accordingly. Does this fully work? If so can you explain how? I passing a global function as an argument but it didn't do anything. BTW I have the revise
Pkg installed. Here's the code I tested:
module ImageCompare
using CImGui
#@run include(joinpath(pathof(CImGui), "..", "..", "demo", "demo.jl"))
#@run include(joinpath(pathof(CImGui), "..", "..", "examples", "demo.jl"))
include(joinpath(pathof(CImGui), "..", "..", "examples", "Renderer.jl"))
using .Renderer
function ui()
CImGui.Begin("Hello ImGui AGAIN!")
CImGui.Button("My Button") && @show "triggered"
CImGui.End()
CImGui.ShowMetricsWindow()
end
function test()
# Default: without hotloading
# Renderer.render(title = "IMGUI Window") do
# CImGui.Begin("Hello ImGui")
# CImGui.Button("My Button") && @show "triggered"
# CImGui.End()
# CImGui.ShowMetricsWindow()
# end
Renderer.render(ui, title = "IMGUI Window", hotloading=true)
end
export test
end
Here are the steps I tried:
using ImageCompare
then test()
Hello ImGui AGAIN
by something else. Save the file.using ImageCompare
in case that mattered. I don't notice any changes to the ImGui window.When I'm trying to draw some Fractals, It's easy to touch this limit.
What would need to be done to support ImGui docking?
Upstream, cimgui
appears to have a docking branch, so I imagine it's just a matter of updating the Yggdrasil
build script to target the appropriate commits of ImGui and cimgui. However, where I get a bit lost is on how to connect everything together.
Should someone hoping to add this support create PRs in Yggdrasil, CimGui_jll, and this repo? Should those PRs all target a separate branch, or should Yggdrasil's PR target master but in a different subfolder?
None of words belows are printed (I've used typeface for https://github.com/IBM/plex/releases)
CImGui.Text("한글은 안되는데") # korean
CImGui.Text("早上好")
CImGui.Text("🙋♂️🛑🙋♀️😁😘✌🌹🎉🎂") # some randome unicodes
CImGui.Text("γΠρϔͽͷͻ⅟₀₁⅛₀⅔ⅢⅦ⋡⋛⋎⋓⋜⨔⨏⨍⨕⫟⫩⫪")
here is my test code
using CImGui
using CImGui.CSyntax
using CImGui.CSyntax.CStatic
using CImGui.GLFWBackend
using CImGui.OpenGLBackend
using CImGui.GLFWBackend.GLFW
using CImGui.OpenGLBackend.ModernGL
@static if Sys.isapple()
# OpenGL 3.2 + GLSL 150
const glsl_version = 150
GLFW.WindowHint(GLFW.CONTEXT_VERSION_MAJOR, 3)
GLFW.WindowHint(GLFW.CONTEXT_VERSION_MINOR, 2)
GLFW.WindowHint(GLFW.OPENGL_PROFILE, GLFW.OPENGL_CORE_PROFILE) # 3.2+ only
GLFW.WindowHint(GLFW.OPENGL_FORWARD_COMPAT, GL_TRUE) # required on Mac
else
# OpenGL 3.0 + GLSL 130
const glsl_version = 130
GLFW.WindowHint(GLFW.CONTEXT_VERSION_MAJOR, 3)
GLFW.WindowHint(GLFW.CONTEXT_VERSION_MINOR, 0)
# GLFW.WindowHint(GLFW.OPENGL_PROFILE, GLFW.OPENGL_CORE_PROFILE) # 3.2+ only
# GLFW.WindowHint(GLFW.OPENGL_FORWARD_COMPAT, GL_TRUE) # 3.0+ only
end
function UnicodeTest()
# setup GLFW error callback
error_callback(err::GLFW.GLFWError) = @error "GLFW ERROR: code $(err.code) msg: $(err.description)"
GLFW.SetErrorCallback(error_callback)
# create window
window = GLFW.CreateWindow(1280, 1440, "Demo")
@assert window != C_NULL
GLFW.MakeContextCurrent(window)
GLFW.SwapInterval(1) # enable vsync
# setup Dear ImGui context
ctx = CImGui.CreateContext()
# setup Dear ImGui style
CImGui.StyleColorsDark()
# CImGui.StyleColorsClassic()
# CImGui.StyleColorsLight()
# load Fonts
# - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use `CImGui.PushFont/PopFont` to select them.
# - `CImGui.AddFontFromFileTTF` will return the `Ptr{ImFont}` so you can store it if you need to select the font among multiple.
# - If the file cannot be loaded, the function will return C_NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
# - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling `CImGui.Build()`/`GetTexDataAsXXXX()``, which `ImGui_ImplXXXX_NewFrame` below will call.
# - Read 'fonts/README.txt' for more instructions and details.
fonts_dir = joinpath(@__DIR__, "resources")
fonts = CImGui.GetIO().Fonts
# default_font = CImGui.AddFontDefault(fonts)
CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "IBMPlexSansKR-Regular.ttf"), 16)
# @assert default_font != C_NULL
# setup Platform/Renderer bindings
ImGui_ImplGlfw_InitForOpenGL(window, true)
ImGui_ImplOpenGL3_Init(glsl_version)
try
show_demo_window = true
clear_color = Cfloat[0.45, 0.55, 0.60, 1.00]
while !GLFW.WindowShouldClose(window)
GLFW.PollEvents()
# start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame()
ImGui_ImplGlfw_NewFrame()
CImGui.NewFrame()
# show another simple window.
@cstatic f=Cfloat(0.0) counter=Cint(0) begin
CImGui.Begin("Hello, world!")
CImGui.Text("한글은 안되는데") # korean
CImGui.Text("早上好")
CImGui.Text("🙋♂️🛑🙋♀️😁😘✌🌹🎉🎂") # some randome unicodes
CImGui.Text("γΠρϔͽͷͻ⅟₀₁⅛₀⅔ⅢⅦ⋡⋛⋎⋓⋜⨔⨏⨍⨕⫟⫩⫪")
CImGui.Text(@sprintf("Application average %.3f ms/frame (%.1f FPS)", 1000 / CImGui.GetIO().Framerate, CImGui.GetIO().Framerate))
CImGui.End()
end
# rendering
CImGui.Render()
GLFW.MakeContextCurrent(window)
display_w, display_h = GLFW.GetFramebufferSize(window)
glViewport(0, 0, display_w, display_h)
glClearColor(clear_color...)
glClear(GL_COLOR_BUFFER_BIT)
ImGui_ImplOpenGL3_RenderDrawData(CImGui.GetDrawData())
GLFW.MakeContextCurrent(window)
GLFW.SwapBuffers(window)
end
catch e
@error "Error in renderloop!" exception=e
Base.show_backtrace(stderr, catch_backtrace())
finally
ImGui_ImplOpenGL3_Shutdown()
ImGui_ImplGlfw_Shutdown()
CImGui.DestroyContext(ctx)
GLFW.DestroyWindow(window)
end
end
It seems that disabling/greying-out widgets to prevent user interaction in imgui itself isn't well implemented (see ocornut/imgui#211), but I was wondering whether that functionality is somehow added/addable through CImGui.jl?
Also, thanks for all the work on this package! It's been a delight to work with
I read the imgui_demo.cpp from https://pthom.github.io/imgui_manual_online/manual/imgui_manual.html to find the usage of dockspace
ImGui::DockSpaceOverViewport(ImGui::GetMainViewport());
but in LibCImGui, it is like this
function igDockSpaceOverViewport(viewport, flags, window_class)
ccall((:igDockSpaceOverViewport, libcimgui), ImGuiID, (Ptr{ImGuiViewport}, ImGuiDockNodeFlags, Ptr{ImGuiWindowClass}), viewport, flags, window_class)
end
How can I get a ImGuiWindowClass object?
Julia Version: 1.3.1
i got an error in the wrapper:
┌ Error: Error in drawGUI! exception =
│ exception = UndefVarError: igTreeAdvanceToLabelPos not defined
└ ...
Stacktrace:
[1] TreeAdvanceToLabelPos() at ... \.julia\packages\CImGui\OGzct\src\wrapper.jl:1484
...
Do you use the correct ImGUI version?
I guess some functions are missing or deprecated.
The current example Renderer.jl is not compatible with CImGui.jl master (which is v1.82.0 ?)
I figured, that I have to replace
using CImGui.GLFWBackend
using CImGui.OpenGLBackend
using CImGui.GLFWBackend.GLFW
using CImGui.OpenGLBackend.ModernGL
with
using CImGui.ImGuiGLFWBackend
using CImGui.ImGuiOpenGLBackend
using CImGui.ImGuiGLFWBackend.LibGLFW
using CImGui.ImGuiOpenGLBackend.ModernGL
But then I run into the next error:
ERROR: LoadError: UndefVarError: ImGui_ImplGlfw_InitForOpenGL not defined
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
cimgui now supports v1.80 (with tables), please update CImGui if possible.
And could you return to the docking support question, please.
The code in examples
/ is apparently unused, with the real demo window being provided by CImGui.ShowDemoWindow
. Is there a reason for this? I've noticed that the code in the examples doesn't all work; for example, ImDrawCornerFlags_*
are no longer defined in CImGui, causing the custom rendering examples to break.
Memory leak when launching examples of the master branch of CImGui (launch occurs as described in the readme file)
Hello, I have just recently read about this Wrapper. Thank you for porting!
For a multi-window setup I found that SetCurrentContext
is exported, but additionally I had to manually save and restore all global variables g_*
from CImGui.OpenGLBackend
and CImGui.GLFWBackend
per-window setup
if isa(state.lastImGuiPlot,Base.RefValue)
saveImGuiState(state.lastImGuiPlot[])
state.lastImGuiPlot = Ptr{PlotState}(C_NULL)
end
CImGui.OpenGLBackend.__init__()
CImGui.GLFWBackend.__init__()
p.imguictx = CImGui.CreateContext()
CImGui.SetCurrentContext(p.imguictx)
CImGui.StyleColorsDark()
ImGui_ImplGlfw_InitForOpenGL(p.window, false)
ImGui_ImplOpenGL3_Init(glversion)
saveImGuiState(p)
rendering:
CImGui.SetCurrentContext(p.imguictx)
restoreImGuiState(p)
ImGui_ImplOpenGL3_NewFrame()
ImGui_ImplGlfw_NewFrame()
CImGui.NewFrame()
...
with something like this
function saveImGuiState(p :: PlotState)
p.imgui_opengl_state.g_AttribLocationColor = CImGui.OpenGLBackend.g_AttribLocationColor
p.imgui_opengl_state.g_AttribLocationTex = CImGui.OpenGLBackend.g_AttribLocationTex
p.imgui_opengl_state.g_FontTexture = CImGui.OpenGLBackend.g_FontTexture
p.imgui_opengl_state.g_ImageTexture = CImGui.OpenGLBackend.g_ImageTexture
p.imgui_opengl_state.g_VertHandle = CImGui.OpenGLBackend.g_VertHandle
p.imgui_opengl_state.g_AttribLocationPosition = CImGui.OpenGLBackend.g_AttribLocationPosition
p.imgui_opengl_state.g_AttribLocationUV = CImGui.OpenGLBackend.g_AttribLocationUV
p.imgui_opengl_state.g_FragHandle = CImGui.OpenGLBackend.g_FragHandle
p.imgui_opengl_state.g_ShaderHandle = CImGui.OpenGLBackend.g_ShaderHandle
p.imgui_opengl_state.g_AttribLocationProjMtx = CImGui.OpenGLBackend.g_AttribLocationProjMtx
p.imgui_opengl_state.g_ElementsHandle = CImGui.OpenGLBackend.g_ElementsHandle
p.imgui_opengl_state.g_GlslVersion = CImGui.OpenGLBackend.g_GlslVersion
p.imgui_opengl_state.g_VboHandle = CImGui.OpenGLBackend.g_VboHandle
p.imgui_glfw_state.g_ClientApi = CImGui.GLFWBackend.g_ClientApi
p.imgui_glfw_state.g_ImplGlfw_SetClipboardText = CImGui.GLFWBackend.g_ImplGlfw_SetClipboardText
p.imgui_glfw_state.g_MouseJustPressed = CImGui.GLFWBackend.g_MouseJustPressed
p.imgui_glfw_state.g_Window = CImGui.GLFWBackend.g_Window
p.imgui_glfw_state.g_ImplGlfw_GetClipboardText = CImGui.GLFWBackend.g_ImplGlfw_GetClipboardText
p.imgui_glfw_state.g_MouseCursors = CImGui.GLFWBackend.g_MouseCursors
p.imgui_glfw_state.g_Time = CImGui.GLFWBackend.g_Time
end
function restoreImGuiState(p :: PlotState)
if isa(state.lastImGuiPlot,Base.RefValue)
saveImGuiState(state.lastImGuiPlot[])
end
state.lastImGuiPlot = Ref(p)
CImGui.OpenGLBackend.Set_g_AttribLocationColor( p.imgui_opengl_state.g_AttribLocationColor)
CImGui.OpenGLBackend.Set_g_AttribLocationTex( p.imgui_opengl_state.g_AttribLocationTex)
CImGui.OpenGLBackend.Set_g_FontTexture( p.imgui_opengl_state.g_FontTexture)
CImGui.OpenGLBackend.Set_g_ImageTexture( p.imgui_opengl_state.g_ImageTexture)
CImGui.OpenGLBackend.Set_g_VertHandle( p.imgui_opengl_state.g_VertHandle)
CImGui.OpenGLBackend.Set_g_AttribLocationPosition( p.imgui_opengl_state.g_AttribLocationPosition)
CImGui.OpenGLBackend.Set_g_AttribLocationUV( p.imgui_opengl_state.g_AttribLocationUV)
CImGui.OpenGLBackend.Set_g_FragHandle( p.imgui_opengl_state.g_FragHandle)
CImGui.OpenGLBackend.Set_g_ShaderHandle( p.imgui_opengl_state.g_ShaderHandle)
CImGui.OpenGLBackend.Set_g_AttribLocationProjMtx( p.imgui_opengl_state.g_AttribLocationProjMtx)
CImGui.OpenGLBackend.Set_g_ElementsHandle( p.imgui_opengl_state.g_ElementsHandle)
CImGui.OpenGLBackend.Set_g_GlslVersion( p.imgui_opengl_state.g_GlslVersion)
CImGui.OpenGLBackend.Set_g_VboHandle( p.imgui_opengl_state.g_VboHandle)
CImGui.GLFWBackend.Set_g_ClientApi( p.imgui_glfw_state.g_ClientApi)
CImGui.GLFWBackend.Set_g_ImplGlfw_SetClipboardText( p.imgui_glfw_state.g_ImplGlfw_SetClipboardText)
CImGui.GLFWBackend.Set_g_MouseJustPressed( p.imgui_glfw_state.g_MouseJustPressed)
CImGui.GLFWBackend.Set_g_Window( p.imgui_glfw_state.g_Window)
CImGui.GLFWBackend.Set_g_ImplGlfw_GetClipboardText( p.imgui_glfw_state.g_ImplGlfw_GetClipboardText)
CImGui.GLFWBackend.Set_g_MouseCursors( p.imgui_glfw_state.g_MouseCursors)
CImGui.GLFWBackend.Set_g_Time( p.imgui_glfw_state.g_Time)
end
Is there a chance to have these two variable-sets attached to the "current" ImGui context?
regards,
Christian
I'm on OSX 10.11.6. Normally I use either Atom or VSCode. Neither can run the demo. What is the preferred workflow with CLmGui? It looks great just trying to get going.
Hi,
I have recently begun to switch my project to the newer version. And albeit for the most part it was a pretty painless transition, strings just don't want to behave properly.
the demo app include(joinpath(pathof(CImGui), "..", "..", "demo", "demo.jl"))
segafults with
signal (11): Segmentation fault: 11
in expression starting at /Users/user/.local/julia/packages/CImGui/EBKak/demo/demo.jl:66
_platform_strlen at /usr/lib/system/libsystem_platform.dylib (unknown line)
Allocations: 8846575 (Pool: 8841676; Big: 4899); GC: 9
I tried all sort of combinations (yes also @sprintf
) but the only one that works is if I override with the following
CImGui.Text(text) = CImGui.TextUnformatted(text)
(basically we force to input the \0
at the end)
If I add a \0
manually, unsafe_convert
gets angry
┌ Error: Error in renderloop!
│ exception = ArgumentError: embedded NULs are not allowed in C strings: "This is some useful text.\0"
└ @ Main ~/.local/julia/packages/CImGui/EBKak/demo/demo.jl:125
Stacktrace:
[1] unsafe_convert
@ ./c.jl:216 [inlined]
[2] igText(text::String)
@ LibCImGui ~/.local/julia/packages/LibCImGui/DfBwq/src/LibCImGui.jl:41
[3] Text
@ ~/.local/julia/packages/CImGui/EBKak/src/wrapper.jl:1030 [inlined]
[4] top-level scope
@ ~/.local/julia/packages/CImGui/EBKak/demo/demo.jl:84
but at least it shows that it is doing what it is supposed to do (i think).
when running everything through rosetta, it works.
I am not even sure this is an issue of this package, could it be an issue of julia on aarm?
When I use CImGui.SetItemAllowOverlap of version 1.89 for two widgets, the latter one can be hovered but not activated. It's fine for 1.82.
Originally posted by Faresx March 21, 2023
The getproperty and setproperty! method of ImNodesStyle was not provided.
style = imnodes_GetStyle()
unsafe_load(Ptr{Cfloat}(style+0))
will crash.
What should be done do make this release?
If you look at this issue in imgui (NOT CImGui)
you will see that InvisibleButton should take 3 arguments, the last being flags.
However when I execute InvisibleButton with 3 arguments I get:
│ MethodError: no method matching InvisibleButton(::String, ::ImVec2, ::UInt32)
│ Closest candidates are:
│ InvisibleButton(::Any, ::Any) at /home/briand/.julia/packages/CImGui/vVLHW/src/wrapper.jl:1104
└ @ Renderer ~/src/julia/imgui/test1/Renderer.jl:77
Seeing that the 3rd argument change was in mid-2020, i'm wondering if maybe CImGui may need a minor update ?
Hi,
I have noticed some Memory leak in the multicontext.jl
example.
It could be a GPU memory issue (which is probably backed by system memory), since I experience a whole desktop freeze, although the system memory is not fully exhausted (such behaviour I experienced as a GPU memory issue on my system before).
The demo.jl
seems to run with a stable memory usage.
regards,
Since Dear ImGui is often patched or extended to support new features or improve in certain areas of the library, it's often a desire of mine to be able to recompile the underlying C++ library with a patched Dear ImGui codebase. I haven't yet tried to do this, because it isn't documented 😄 Is there any chance we could have a simple set of step-by-step instructions on how to do this?
Tried to run this example on another Windows 10 machine, https://gist.github.com/sairus7/c87a7dc82af4859dd0c2f8dc58d361c0
got the error
window = glfwCreateWindow(width, height, title, C_NULL, C_NULL)
@assert window != C_NULL
ERROR: AssertionError: window != C_NULL
Any idea where at least I should start looking for the bug?
Can we?
Changes on the CImGui side: 3f83d04
Hi,
I'm having trouble figuring out how to use CImGui.InputText()
. The examples in the demo work correctly, but whenever I try to incorporate something similar I encounter an embedded NULs are not allowed in C strings:
error. For example, the following does not work
buf="dummy"*"\0"^(27)
CImGui.InputText("dummy", buf, length(buf)) # ArgumentError: embedded NULs are not allowed in C strings
I've made a standalone script which attempts to imitate an example in the demos:
using CImGui
using CImGui.CSyntax
using CImGui.CSyntax.CStatic
using CImGui.GLFWBackend
using CImGui.OpenGLBackend
using CImGui.GLFWBackend.GLFW
using CImGui.OpenGLBackend.ModernGL
using Printf
@static if Sys.isapple()
# OpenGL 3.2 + GLSL 150
glsl_version = 150
GLFW.WindowHint(GLFW.CONTEXT_VERSION_MAJOR, 3)
GLFW.WindowHint(GLFW.CONTEXT_VERSION_MINOR, 2)
GLFW.WindowHint(GLFW.OPENGL_PROFILE, GLFW.OPENGL_CORE_PROFILE) # 3.2+ only
GLFW.WindowHint(GLFW.OPENGL_FORWARD_COMPAT, GL_TRUE) # required on Mac
else
# OpenGL 3.0 + GLSL 130
glsl_version = 130
GLFW.WindowHint(GLFW.CONTEXT_VERSION_MAJOR, 3)
GLFW.WindowHint(GLFW.CONTEXT_VERSION_MINOR, 0)
# GLFW.WindowHint(GLFW.OPENGL_PROFILE, GLFW.OPENGL_CORE_PROFILE) # 3.2+ only
# GLFW.WindowHint(GLFW.OPENGL_FORWARD_COMPAT, GL_TRUE) # 3.0+ only
end
# setup GLFW error callback
error_callback(err::GLFW.GLFWError) = @error "GLFW ERROR: code $(err.code) msg: $(err.description)"
GLFW.SetErrorCallback(error_callback)
# create window
window = GLFW.CreateWindow(1280, 720, "Demo")
@assert window != C_NULL
GLFW.MakeContextCurrent(window)
GLFW.SwapInterval(1) # enable vsync
# setup Dear ImGui context
ctx = CImGui.CreateContext()
# setup Dear ImGui style
CImGui.StyleColorsDark()
# setup Platform/Renderer bindings
ImGui_ImplGlfw_InitForOpenGL(window, true)
ImGui_ImplOpenGL3_Init(glsl_version)
should_show_dialog = true
clear_color = Cfloat[0.45, 0.55, 0.60, 1.00]
current_path = pwd()
while !GLFW.WindowShouldClose(window)
GLFW.PollEvents()
# start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame()
ImGui_ImplGlfw_NewFrame()
CImGui.NewFrame()
# ArgumentError: embedded NULs are not allowed in C strings:
@cstatic buf="dummy"*"\0"^(27) begin
CImGui.InputText("1", buf, length(buf))
end
# rendering
CImGui.Render()
GLFW.MakeContextCurrent(window)
display_w, display_h = GLFW.GetFramebufferSize(window)
glViewport(0, 0, display_w, display_h)
glClearColor(clear_color...)
glClear(GL_COLOR_BUFFER_BIT)
ImGui_ImplOpenGL3_RenderDrawData(CImGui.GetDrawData())
GLFW.MakeContextCurrent(window)
GLFW.SwapBuffers(window)
end
# cleanup
ImGui_ImplOpenGL3_Shutdown()
ImGui_ImplGlfw_Shutdown()
CImGui.DestroyContext(ctx)
GLFW.DestroyWindow(window)
This error is as follows:
ERROR: LoadError: ArgumentError: embedded NULs are not allowed in C strings: "dummy\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
Stacktrace:
[1] igInputText(::String, ::String, ::Int64, ::Int64, ::Ptr{Nothing}, ::Ptr{Nothing}) at ./c.jl:216
[2] InputText at /home/zygmunt/.julia/packages/CImGui/PuVOE/src/wrapper.jl:1298 [inlined] (repeats 2 times)
[3] top-level scope at /home/zygmunt/.julia/dev/ElectrodermalActivity/src/standalone.jl:59 [inlined]
[4] top-level scope at ./none:0
in expression starting at /home/zygmunt/.julia/dev/ElectrodermalActivity/src/standalone.jl:49
I suspect that I am using the API incorrectly. I haven't yet worked with a scenario where I was passing data structures to a C-library so I'd appreciate any suggestions you may have.
using CImGui
include(joinpath(pathof(CImGui), "..", "..", "examples", "demo.jl"))
when I run the codes above, I get crashed
Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x6bd6ffe1 -- _ZN11ImFontAtlas7AddFontEPK12ImFontConfig at C:\Users\22112\.julia\artifacts\27ef50bab46adeedd512c09d3e6ee063ba1da615\bin\libcimgui.dll (unknown line)
in expression starting at C:\Users\22112\.julia\packages\CImGui\HviPp\examples\demo.jl:65
_ZN11ImFontAtlas7AddFontEPK12ImFontConfig at C:\Users\22112\.julia\artifacts\27ef50bab46adeedd512c09d3e6ee063ba1da615\bin\libcimgui.dll (unknown line)
_ZN11ImFontAtlas18AddFontFromFileTTFEPKcfPK12ImFontConfigPKt at C:\Users\22112\.julia\artifacts\27ef50bab46adeedd512c09d3e6ee063ba1da615\bin\libcimgui.dll (unknown line)
ImFontAtlas_AddFontFromFileTTF at C:\Users\22112\.julia\packages\LibCImGui\DfBwq\lib\x86_64-w64-mingw32.jl:5615 [inlined]
AddFontFromFileTTF at C:\Users\22112\.julia\packages\CImGui\HviPp\src\wrapper.jl:3142 [inlined]
AddFontFromFileTTF at C:\Users\22112\.julia\packages\CImGui\HviPp\src\wrapper.jl:3142
unknown function (ip: 0000028fe2713289)
jl_apply at C:/workdir/src\julia.h:1879 [inlined]
do_call at C:/workdir/src\interpreter.c:126
eval_value at C:/workdir/src\interpreter.c:226
eval_stmt_value at C:/workdir/src\interpreter.c:177 [inlined]
eval_body at C:/workdir/src\interpreter.c:624
jl_interpret_toplevel_thunk at C:/workdir/src\interpreter.c:762
jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:912
jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:856
ijl_toplevel_eval at C:/workdir/src\toplevel.c:921 [inlined]
ijl_toplevel_eval_in at C:/workdir/src\toplevel.c:971
eval at .\boot.jl:370 [inlined]
include_string at .\loading.jl:1903
_include at .\loading.jl:1963
include at .\client.jl:478
unknown function (ip: 0000028fe270ca56)
jl_apply at C:/workdir/src\julia.h:1879 [inlined]
do_call at C:/workdir/src\interpreter.c:126
eval_value at C:/workdir/src\interpreter.c:226
eval_stmt_value at C:/workdir/src\interpreter.c:177 [inlined]
eval_body at C:/workdir/src\interpreter.c:624
jl_interpret_toplevel_thunk at C:/workdir/src\interpreter.c:762
jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:912
jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:856
ijl_toplevel_eval at C:/workdir/src\toplevel.c:921 [inlined]
ijl_toplevel_eval_in at C:/workdir/src\toplevel.c:971
eval at .\boot.jl:370 [inlined]
eval_user_input at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:153
repl_backend_loop at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:249
#start_repl_backend#46 at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:234
start_repl_backend at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:231
#run_repl#59 at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:379
run_repl at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:365
jfptr_run_repl_61185.clone_1 at C:\Users\22112\AppData\Local\Programs\Julia-1.9.2\lib\julia\sys.dll (unknown line)
#1017 at .\client.jl:421
jfptr_YY.1017_34710.clone_1 at C:\Users\22112\AppData\Local\Programs\Julia-1.9.2\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:1879 [inlined]
jl_f__call_latest at C:/workdir/src\builtins.c:774
#invokelatest#2 at .\essentials.jl:816 [inlined]
invokelatest at .\essentials.jl:813 [inlined]
run_main_repl at .\client.jl:405
exec_options at .\client.jl:322
_start at .\client.jl:522
jfptr__start_47602.clone_1 at C:\Users\22112\AppData\Local\Programs\Julia-1.9.2\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:1879 [inlined]
true_main at C:/workdir/src\jlapi.c:573
jl_repl_entrypoint at C:/workdir/src\jlapi.c:717
mainCRTStartup at C:/workdir/cli\loader_exe.c:59
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
Allocations: 7303878 (Pool: 7299944; Big: 3934); GC: 14
I recently discovered this issue, as it was working fine before. Maybe it is not appropriately installed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.