Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficulties with current Renderer.jl #66

Closed
zsoerenm opened this issue Dec 3, 2021 · 2 comments · Fixed by #67
Closed

Difficulties with current Renderer.jl #66

zsoerenm opened this issue Dec 3, 2021 · 2 comments · Fixed by #67

Comments

@zsoerenm
Copy link

zsoerenm commented Dec 3, 2021

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
@Gnimuc
Copy link
Member

Gnimuc commented Dec 3, 2021

The new interfaces are init, new_frame and shutdown:

ImGuiGLFWBackend.init(window_ctx)
ImGuiOpenGLBackend.init(gl_ctx)

ImGuiOpenGLBackend.new_frame(gl_ctx)
ImGuiGLFWBackend.new_frame(window_ctx)

ImGuiOpenGLBackend.shutdown(gl_ctx)
ImGuiGLFWBackend.shutdown(window_ctx)

X-ref: https://github.com/JuliaImGui/ImGuiGLFWBackend.jl

@Gnimuc
Copy link
Member

Gnimuc commented Dec 3, 2021

If you'd like to use the master branch, make sure you understand this unsafe_load change.

For example, igGetIO() returns a pointer of type Ptr{ImGuiIO}. With this field access method in v1.79, say we have io::Ptr{ImGuiIO}=igGetIO(), then we can run ds = io.DisplaySize to get a value ds of type ImVec2. This may look handy at the first glance. But, it does not support chaining, for example, io.DisplaySize.x cannot work as expected and it's not trivial to make it work in an efficient way. The new field access method generated by Clang.jl now returns a pointer instead of a value. io.DisplaySize.x will return a pointer and one needs to explicitly write unsafe_load(io.DisplaySize.x) to get the value. In this way, we're able to read/load/copy a single value from a big nested struct without copying the whole struct object from C to Julia. So, I think it's worth reworking everything in this new style.

Also, there is a known issue about the multi-viewport support on Windows.

I don't have time to get hands on this project at the moment, but I'd like to help and answer questions if someone would like to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants