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

Idea: Three layers #66

Closed
ctrlcctrlv opened this issue Sep 8, 2020 · 6 comments
Closed

Idea: Three layers #66

ctrlcctrlv opened this issue Sep 8, 2020 · 6 comments

Comments

@ctrlcctrlv
Copy link

Since ImGui is quite incomplete on Vulkan, what do you think of the possibility of adding another Skia layer?

So, basically sandwiching ImGui between two Skia layers. Brilliant or horrible hack?

@aclysma
Copy link
Owner

aclysma commented Sep 8, 2020

I think your better off doing one of the following:

  • If you're familiar with vulkan, fork imgui and patch in support yourself. (It will be a fairly difficult, involved thing to do if you aren't comfortable writing vulkan code directly.) The patch that was linked in the other issue looked along the right track though.
  • Use a different UI system like iced. You may still need to write vulkan rendering code to integrate with the renderer in skulpin.
  • Write your own immediate-mode UI using skia. Some shipped products like chome, flutter, and sublime merge use skia. Possibly you could adapt an existing rust UI crate to draw to skia as a backend.

As your project grows, you'll likely need to take on more of the responsibilities for managing skia, vulkan, windowing, and whatever UI you want to build within it yourself. The goal of this project is to lower that initial barrier to entry. Projects that grow beyond prototyping will (by design) outgrow it and should start relying on the underlying technologies directly. (For example, neovide still uses the renderer but no longer uses the "app" construct provided in this library because they needed more control over the event loop.)

@aclysma aclysma closed this as completed Sep 8, 2020
@ctrlcctrlv
Copy link
Author

So wait, you're saying you want me to vendorize skulpin...?

@aclysma
Copy link
Owner

aclysma commented Sep 9, 2020

More specifically for the above approaches:

  • Extend the existing imgui plugin (and likely rely on a fork of imgui you maintain that has a patch to support textures)
  • Write your own new plugin that supports a different UI system
  • Build your own UI system on top of skia

My comments about neovide were that they use the skulpin-renderer crate but not the "app" functionality in skulpin-app-winit. There is really not all that much code here, it's skia that's doing the heavy lifting, so if you start doing serious edits to the renderer (i.e. adding more layers to the renderer) it may very well make sense for you to vendor it.

@ctrlcctrlv
Copy link
Author

I don't really understand why you dislike the idea of an arbitrary number of layers, or three? Is this "I won't do it" or "I won't accept a patch that does it"?

If you really want me to vendorize, fine, but I like ImGui, and the cases I can think of where I'd want to draw arbitrary bitmap data, that can be fixed with multiple layers.

@ctrlcctrlv
Copy link
Author

Sorry to bother you, but would things be any easier for me if I used SDL2?

Could I use SDL2 to draw an image or multiple Skia layers easier?

ctrlcctrlv added a commit to MFEK/glif that referenced this issue Sep 12, 2020
They finally pushed 0.10.0 to crates.io.

This might change. See aclysma/skulpin#66 (GitHub), @aclysma doesn't
like my multiple layer idea and is urging me to vendorize, so I could
end up doing that some day.
ctrlcctrlv added a commit to MFEK/glif that referenced this issue Sep 12, 2020
They finally pushed 0.10.0 to crates.io.

This might change. See aclysma/skulpin#66 (GitHub), @aclysma doesn't
like my multiple layer idea and is urging me to vendorize, so I could
end up doing that some day.
@ctrlcctrlv
Copy link
Author

Hello

Just for Googlers, the best thing to do is use save and restore on the SkCanvas. Consider that internally in your application as layers, but don't really create multiple SkSurface's / SkCanvas's.

I didn't really understand what those functions did, but I get it now. So, at the beginning of each layer in your application, call save() and at the end restore(). That way you can play with the transformation matrices (important for Qglif) but also zoom out and draw a console or overlay on top.

So I understand now why this was closed

ctrlcctrlv added a commit to MFEK/glif that referenced this issue Sep 16, 2020
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

No branches or pull requests

2 participants