-
-
Notifications
You must be signed in to change notification settings - Fork 669
is graphics rendering possible? #4
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
Comments
No, WebAssembly does not have direct DOM access. The only way to render to canvas, or update any HTML is via importing JavaScript functions into your wasm module. |
clear now thanks. |
Does WebAssembly have Canvas API support? |
No, it doesn’t have support directly. All WebAssembly can do is perform computations, reading and writing to memory. For everything else, you’ll need to import JavaScript functions that provide an interface into DOM / canvas etc ... |
Things like these will become more efficient once host-bindings lands. From an AssemblyScript point of view, this could then look like in this String experiment, being part of stdlib, so Web-APIs "just work". |
what about webgl? can we use that for rendering in WASM. Recently I have been looking into rust lang. It seems to be possible. |
It's just like with the game of life example: They are importing their own helpers to make it possible. You can do the same in AS. |
@dcodeIO thanks! :) you made it really clear for me. |
updated for assemblyscript v0.7.0
Hi,
I am looking to render graphics in canvas element via WASM, instead of JavaScript. Is this possible with AssemblyScript?
For example, in game of life demo - rendering is done via javascript, is it possible to move it to assembly code?
The text was updated successfully, but these errors were encountered: