Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Crash On Rendering Window Minimized or IMGUI Window Collapse #3

Open
jalius opened this issue Nov 10, 2023 · 1 comment
Open

Crash On Rendering Window Minimized or IMGUI Window Collapse #3

jalius opened this issue Nov 10, 2023 · 1 comment

Comments

@jalius
Copy link

jalius commented Nov 10, 2023

Hi,

The app crashes on implot.plot_xxx if the rendering window is minimized or the imgui window is collapsed.

Exception has occurred: ImGuiError
ImGui assertion error ((gp.CurrentPlot != 0) && "PlotX() needs to be called between BeginPlot() and EndPlot()!") at implot-cpp/implot_items.cpp:165

Is there a workaround for this or am I doing something wrong?
I'm using flags = imgui.WINDOW_NO_COLLAPSE to stop it crashing on window collapse, but if I minimize the rendering window (GLFW 3, windows 11) it crashes with the same exception.

@jalius
Copy link
Author

jalius commented Nov 10, 2023

Ok, I'm checking for window minimized (i.e. glfw.ICONIFIED) in GLFW before doing my implot draw calls in on_frame(). This seems to stop it from crashing.
Main loop:

while not glfw.window_should_close(window):
        glfw.poll_events()
        impl.process_inputs()
        imgui.new_frame()
        if not glfw.get_window_attrib(window, glfw.ICONIFIED):
            on_frame()
        gl.glClearColor(1.0, 1.0, 1.0, 1)
        gl.glClear(gl.GL_COLOR_BUFFER_BIT)
        imgui.render()
        impl.render(imgui.get_draw_data())
        glfw.swap_buffers(window)

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

No branches or pull requests

1 participant