Multiple Makie display windows

Hi,

I am wandering if multiply Makie Display Windows could be created with different scenes, could be very useful when compare several 3D plots.

Right now, we only support one screen; however, you can vbox or hbox your plots together to show them on one screen.

1 Like

Has this changed in the mean time?
It would be useful to branch out modal dialogues etc. form Makie, for example to collect some input parameters, but also mlutiple figures, which the user can easily minimize etc would be quite useful for user interfaces. Is there still no way to start a second Makie figure?
For a proper user interface, this is almost a show stopper.
Also great would be some support for tabs (like in a browser), which is quite useful for larger user interfaces. Any plans on this?

1 Like

It hasn’t changed, yet, no. I’d also like multiple windows, somebody needs to figure out how to do this with glfw, as I think Simon did write Makie with the capability in mind, but it was too much trouble to implement it correctly

1 Like

I see. Yes, it would be great, if multiple widows worked. Do you know what would be the entry point in GLMakie to look for the creating of the GL Window?

using GLFW
win1 = GLFW.CreateWindow(640, 480, "GLFW.jl")
win2 = GLFW.CreateWindow(640, 480, "GLFW.jl")

does not seem to have any problem with several GLFW windows. But then you are not using GLWF.CreateWindow. `The trouble is that debugging does not seem to work for some reason, so its really hard to find the correct entry point. In Debug mode no window appears, not even during “run without debugging” in vscode. How are you debugging your code?

The main problem is the resource management of the opengl renderloop.
One thing is, multiple windows without multithreading is pretty expensive, so the correct solution would be to use multiple threads per window, which is a whole different rabbit hole… But yeah, its annoying enough to make OpenGL, a library with inherently global state, work with multiple windows…

1 Like

Would maybe be good to invest in multithreading anyway. It did not exist yet when makie was written, of course

How is it done currently? One thread for the “window”? How is the window created, if not via GLFW.CreateWindow()? It looks like there is already a “context switching” implemented. Can this not be extended to mulitple windows?

I see. But maybe this is a lot easier now, since multithreading is there. Why would one need mutiple threads per window instead of just one that handles the event loop?

Because OpenGL context switches are pretty expensive, and if we have one thread per window, we don’t need to switch the context…

It uses GLFW.Window() here: Makie.jl/screen.jl at faa4cc0109b7b6932622c9bf74f1c8881e759f4e · JuliaPlots/Makie.jl · GitHub

Great. Wonder why my search via vscode did not find this. Any idea, why the debugger does not work with the code and is there a way to make it work?

I looked at the code and played a bit with it. You already have quite a bit of code to support multiple screens, but then the first display of a new figure forces a new screen and the destruction of all previous screens. If one turns this off, multiple screens can easily be constructed, and I managed to keep the figure open when I switch the context to a new figure :slight_smile: Yet so far no success in switching the context back to the previous figure. For some reason, the only way to not cause serious hiccups in the rendering was to force the handle of the previous Window to zero. But reinstantiating this from a list of saved handles and switching the context back to that window did not really help.

Any ideas how to go further from here?

By the way: the line

function Scene( ....
        current_screens::Vector{AbstractScreen},
        ...

maybe was meant to be:

        current_screens::Vector{<:AbstractScreen},

to cover the more general case of existing current_screens?

1 Like

If you already have code, this is can be much better discussed as part of a PR, where we can also see what you’ve done so far :wink:

It is very far from a pull request, but you can look at the fork.
We can discuss on the issue page of that fork?

There are draft PRs, which are perfect for this situation :wink:

1 Like

Hello Rainer,
I wonder if you are still working on this? I am using the old Winston.jl and considered switching to Makie, but I reconsidered after seeing it does not support multiple windows. Winston.jl uses GTK to handle the windows, and it is very nice to be able to select windows and save the contents to file after generating a bunch of plots.

1 Like

Yes, we are still interested. Currently we are trying out Genie.jl and Stipple.jl, but the documentation there is a bit of a problem as it seems.
We are also considering Napari-based data display, as well, but it would be nice to handle the interface in Julia and not in Python.
We need the multiple windows since the worksflows are relatively complicated and one may need modal dialogues.

Aha. Thx. Such complicated software stacks to do what used to be “simple” in tcltk.