Nannou: Keep in mind WASM support. Have some examples.

Created on 18 Oct 2017  路  7Comments  路  Source: nannou-org/nannou

platform - web

Most helpful comment

@mitchmindtree FWIW we're working through initial gfx-hal (~Vulkan) to WebGL translation in https://github.com/gfx-rs/gfx/pull/2554

All 7 comments

I just discovered this package. Does this package support wasm out of the box? does it have examples?

Hi!

No we don't have out-of-the-box support for WASM yet, but it is a goal we'd like to get around to at some point.

The first step that comes to mind will be winit landing the EventLoop 2.0 PR changes into master (still pending macos and x11 support). The new API has been in the works for a long time and will lend itself much more nicely to WASM support than the current API. Integration of the new winit API should be fairly trivial for nannou.

The next major step is coming up for a solution for rendering. There are two major areas that come to mind:

  1. HTML rendering. Most webapps need at least some HTML at the top level of the app for searchability / browsability. @freesig mentioned yew seemed like a nice solution to this, though still has a lot of work to go.
  2. WebGL rendering. nannou v0.9 removes the OpenGL support for native applications in favour of using Vulkan under the hood (see some reasoning etc at #240 for info on the choice and more info on v0.9). This does mean that we'll need to come up with some sort of solution that involves either 1. a vulkan -> webgl translation layer of some sort (I'm not currently aware of any) or 2. a platform-specific webgl backend for the wasm target.

The final step that comes to mind is webaudio support. The best approach for this would likely be contributing to the CPAL crate. We've already contributed the coreaudio and ASIO (pending merge) backends so this should be more than feasible.

In summary, support for this is certainly a goal for us, however refining the native application experience first has been a priority as most of our commercial work using nannou so far has gone in this direction.

Thanks for the thoughtful answer!

@mitchmindtree FWIW we're working through initial gfx-hal (~Vulkan) to WebGL translation in https://github.com/gfx-rs/gfx/pull/2554

Just as heads up:

Any news on this?

@mtnmts slow progress! Now that winit seems to be getting close to stabilising their event loop 2.0 work, the main areas left to address here are properly supporting graphics and audio on the web.

Graphics

Currently the plan of attack is to take advantage of the gfx stack via rendy - you can read a little more on this at #374. @freesig, @JoshuaBatty and I had some long meetings about this during RustFest BCN and have started some initial experiments with rendy locally in order to better familiarise with its codebase and to start on a conrod_rendy backend to start by getting Ui working. This along with updating the rest of nannou's graphics stack will likely take a few months as the three of us also have some contract work in the meantime. That said, anyone is welcome to step up and take the lead if interested in accelerating the process, we would be more than happy to provide assistance/guidance! It's worth keeping in mind that targeting WebGL with rendy is still a WIP, but as far as I'm aware the biggest blocker is the winit event loop 2.0 work becoming stable, so I expect to see some rendy WebGL examples in the near future.

Audio

We recently received a grant partly aimed at addressing rust audio on the web which you can read more about here. The final step in finalising the agreement with Mozilla is taking a little longer than anticipated, but as soon as that's sorted I'll dive in.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

freesig picture freesig  路  3Comments

mitchmindtree picture mitchmindtree  路  4Comments

bcbroom picture bcbroom  路  3Comments

dimitre picture dimitre  路  4Comments

mkesper picture mkesper  路  4Comments