-
Notifications
You must be signed in to change notification settings - Fork 64
Implement multi-window support #55
base: master
Are you sure you want to change the base?
Conversation
This commit relies on window selector from Emscripten runtime but should work in single-window case when window selector is not supported.
Not sure I like this approach. It should work fine for software but GL will be a mess (every window will have the same context). I always intended to implement multi-window by mapping multiple windows to multiple canvases, but never had the time actually implement it. My plan was something like this:
|
It can probably have the same logic: window switcher, one-window-at-a-time, SHOWN/HIDDEN notifications, but with reworked support from Emscripten, so |
If you have per-canvas visibility events, then it would be up to the shell (switching, side by side or even a simple window manager) and it shouldn't involve that many changes in SDL. I'd try to avoid using |
Got it, thank you. I will probably try to modify this PR according to this, but some time later. |
Not sure how much work is involved for the EGL part though, it was mentioned in one of the other issues that EGL support was getting rewritten: #48 (comment) |
Did some work on |
With some EGL work (emscripten-core/emscripten@incoming...Daft-Freak:egl-rewrite), I have the GLES renderer working on multiple canvases. |
Wow, very cool @Daft-Freak! :) |
@Daft-Freak your links seems to be presently broken. Can you fix them or upload that files to github? AFAIK your example of rendering on multiple canvases using SDL and GLES is unique. UPD: Now it's fine. 😁 |
@Daft-Freak Can you please share the source code of your two examples? Why does the second example show a strong performance decrease? |
The first was testnative from the branch (possibly modified to force software), the second is this modified version. |
In my port of QEMU to JavaScript I use their SDL2 UI for graphics. Previously, I had to disable every window except one, otherwise the canvas was messed up.
In this PR, SDL2 support for multiple windows is implemented for Emscripten.
This PR relies on window selector from Emscripten runtime (emscripten-core/emscripten#6374) but should work in single-window case when window selector is not supported.
PS: Frankly speaking, I'm not familiar with OpenGL at all, but it seems to work in my QEMU port. Corrections are welcome, of course. You can test it with this kludgy gist.