Comments (5)
UPDATE:
Now the master branch supports multi-viewport and this multiple contexts support is being removed since it's not recommended to use Dear ImGui in this way. Also, see #52.
from cimgui.jl.
These global GLFW/OpenGL states are holding temporarily only for rendering purpose. They're not ImGui states. Almost all of them are refreshed in every rendering loop when calling:
ImGui_ImplOpenGL3_NewFrame()
ImGui_ImplGlfw_NewFrame()
except g_Window
and g_FontTexture
. So the hot-fix would be to remove the optimization trick g_FontTexture == 0
used in this line:
CImGui.jl/src/backend/OpenGL/impl.jl
Line 30 in 2b6caaa
and make ImGui_ImplGlfw_NewFrame()
aware of current GLFW window context:
CImGui.jl/src/backend/GLFW/impl.jl
Line 129 in 2b6caaa
function ImGui_ImplGlfw_NewFrame(window)
global g_Time
global g_Window = window
then this modified example will work: https://gist.github.com/Gnimuc/b9308bb8ed0a81b4fe1e76d706837f3d
from cimgui.jl.
Thank you for the example!
except g_Window and g_FontTexture
nice.
I am still experiencing some issues with that fix, that seem to be related to the event handling: for example, in your code multicontext.jl I sometimes cannot close window1 and only window2 and sometimes the other way around.
Also it seems that currently there is no possiblity to manage the callbacks manually via
ImGui_ImplGlfw_MouseButtonCallback
ImGui_ImplGlfw_ScrollCallback
ImGui_ImplGlfw_KeyCallback
ImGui_ImplGlfw_KeyCallback
which might be of interest also for single multiple contexts.
regards,
from cimgui.jl.
That's because the script didn't destory GLFW windows instance in the rendering loop: https://gist.github.com/Gnimuc/b9308bb8ed0a81b4fe1e76d706837f3d#file-multicontext-jl-L118-L123
This can be fixed by something like:
# in rendering loop
GLFW.PollEvents()
if GLFW.WindowShouldClose(window1)
CImGui.DestroyContext(ctx1)
GLFW.DestroyWindow(window1)
end
As for the callbacks, I didn't implement that because I thought they were not very useful in that one can always overload these callbacks before GLFW initialization. But this feature is very simple to implement by following:
https://github.com/ocornut/imgui/blob/d9568c717de8ec53445bad00be73133f1a110317/examples/imgui_impl_glfw.cpp#L82-L83
so feel free to submit a PR. Or I'll fix it this weekend.
from cimgui.jl.
Indeed, I got it working in the way you proposed; the "issues" were just in my implementation. Could resolve them now
from cimgui.jl.
Related Issues (20)
- Is there a way to use the gr framework with CImGui.jl? HOT 2
- update to v1.80 HOT 4
- Long text example crash (`MethodError: no method matching Clipper(::Int64)`) HOT 1
- InvisibleButton should take three arguments HOT 4
- Examples on master branch do not work?
- Tag a 1.82.0 release? HOT 7
- Memory leak HOT 15
- Difficulties with current Renderer.jl HOT 2
- No GUI shown with compiled julia app using CImGui HOT 14
- CImGui fails precompilation at `idGET_FLT_MAX()` HOT 1
- Columns - Horizontal Scroll demo not working in v1.79.0 HOT 3
- TagBot trigger issue HOT 6
- the CImGui.Text(text) function segfaults on aarm (v1.82) HOT 15
- Example code doesn't actually run HOT 6
- Input widgets with different IDs conflict with each other? HOT 5
- How can I get ImGuiWindowClass?
- The getproperty and setproperty! method of ImNodesStyle was not provided
- On some Windows machine, got glfwCreateWindow error HOT 2
- Regenerate new wrapper libraries for fresh ImGui and ImPlot versions? HOT 1
- An error occurs when I use ImGuiTextFilter in a package
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cimgui.jl.