JuliaGraphics / QML.jl

Build Qt6 QML interfaces for Julia programs.
Other
376 stars 35 forks source link

Support latest Makie / GLMakie #173

Open rasmushenningsson opened 11 months ago

rasmushenningsson commented 11 months ago

Currently, QML.jl works well with GLMakie.jl v0.6 (and Makie.jl v0.17). But not with the latest versions - GLMakie.jl v0.8 (and Makie.jl v0.19).

The error message is "GLScreen not defined". Hopefully, this is a rather small fix if you're familiar with the setup, but I'm not certain.

Later, it would also be nice to use the new Package Extensions rather than Requires.jl for Makie support - which among other things makes it possible to put compat bounds for Makie/GLMakie.

ufechner7 commented 11 months ago

Very good suggestions! Makie.jl is hard to support because it is still a rapidly moving target.

barche commented 11 months ago

The plan is to move the Makie support into a separate package. I don't think it's a simple fix to upgrade. Having a separate package will allow us to formally set compat bounds also, currently the limits set in the examples repository are the valid ones.

ufechner7 commented 11 months ago

As first step we could investigate the errors that happen if we use Makie 0.18 ...

pbouffard commented 9 months ago

Just to add a data point, and in case anyone was wondering, the Makie 0.20 beta which has some breaking changes, still suffers from this same error. @SimonDanisch FYI.

JamesWrigley commented 6 months ago

I looked into this ages ago, though unfortunately my discussions with @barche about it are lost to the Slack-hole. As far as I remember, the major blocker is that Makie support depends on QMLScreen subtyping GLMakie.GLScreen: https://github.com/JuliaGraphics/QML.jl/blob/main/src/makie_support.jl#L51

And in Makie 0.18 (or 0.19, my memory is fuzzy) support for the abstract GLMakie.GLScreen was dropped in favour of a concrete Screen type that all methods now require: https://github.com/MakieOrg/Makie.jl/blob/master/GLMakie/src/screen.jl#L159

To add support for more recent versions I think Makie would have to add back support for that abstract type.

rasmushenningsson commented 6 months ago

@JamesWrigley also mentioned on slack that there is a Google Summer Of Code project for this: https://julialang.org/jsoc/gsoc/gui/#qml_and_makie_integration

rasmushenningsson commented 4 months ago

Also see QML Roadmap with discussion here: https://github.com/orgs/JuliaGraphics/discussions/4

rasmushenningsson commented 3 months ago

@JamesWrigley also mentioned on slack that there is a Google Summer Of Code project for this: https://julialang.org/jsoc/gsoc/gui/#qml_and_makie_integration

The 2024 GSOC projects have been announced (https://julialang.org/blog/2024/05/gsoc-2024-fellows/), but QML and Makie integration is not included in the list.

Does this mean that there is no planned work on this at the moment?

ufechner7 commented 3 months ago

Indeed, I don't think there is any planned work on this at the moment. Please correct me if I am wrong.

barche commented 3 months ago

We had no viable GSOC proposals for this topic, but it is still pretty high on my todo list for QML.jl. I can’t give a timeline though.

rasmushenningsson commented 3 months ago

I'm happy to hear that it's still something you want to do! I completely understand that it's not easy to find the time.

JamesWrigley commented 1 month ago

I looked into this ages ago, though unfortunately my discussions with @barche about it are lost to the Slack-hole. As far as I remember, the major blocker is that Makie support depends on QMLScreen subtyping GLMakie.GLScreen: https://github.com/JuliaGraphics/QML.jl/blob/main/src/makie_support.jl#L51

And in Makie 0.18 (or 0.19, my memory is fuzzy) support for the abstract GLMakie.GLScreen was dropped in favour of a concrete Screen type that all methods now require: https://github.com/MakieOrg/Makie.jl/blob/master/GLMakie/src/screen.jl#L159

To add support for more recent versions I think Makie would have to add back support for that abstract type.

I've spent the last few days integrating Makie with CImGui so I understand things a bit better now :sweat_smile:

If I read the code correctly QML.jl currently creates its own Screen and rendering functions, but I think with Makie's current design the integration will be simpler because we only need to worry about the OpenGL window bits (the QML window in this case) and forwarding input (mouse buttons etc) from the window, no need to reimplement the rendering code or anything. What stopped me from re-using more of GLMakie than I currently do is GLMakie assuming that it owns Screen.glscreen and trying to do things like resizing the window or setting window hints. I'd like to make a PR to GLMakie at some point to indicate whether or not the Screen owns the window, and that should make integration even simpler.

JamesWrigley commented 1 month ago

I'd like to make a PR to GLMakie at some point to indicate whether or not the Screen owns the window, and that should make integration even simpler.

Done: https://github.com/MakieOrg/Makie.jl/pull/4073 If anyone wants to get started on fixing the Makie integration in QML.jl, I outlined the basic steps that are necessary in the new docs in the PR.

barche commented 1 month ago

Great, thanks a lot for this, this looks like it will make integrating Makie support a lot easier and cleaner!