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

Question: Why are we exposing canvas elements instead of just any node? #150

Open
madsmtm opened this issue Sep 2, 2023 · 2 comments
Open

Comments

@madsmtm
Copy link
Member

madsmtm commented Sep 2, 2023

Since there are multiple ways to render on the web, including inserting e.g. an svg into the page, it seems to me like it would be more generic to give graphics crates a Node or something, and then let them create and insert an inner element?

Or maybe there's something I'm missing here?

@grovesNL
Copy link
Contributor

grovesNL commented Sep 3, 2023

WebGL and WebGPU both work with canvases, and expect the canvas to already exist somewhere (in memory as an element or offscreen canvas, or a node in the DOM).

People can create canvases ahead of time to style them, insert them at the right place at the DOM, attach event handlers, etc. so it doesn't really make sense for the graphics crate to take on the responsibility of creating it and surfacing ways to do all of these things.

We could also have handles for SVGs or other elements, but in practice this isn't very useful for the places raw-window-handle is currently used.

@notgull
Copy link
Member

notgull commented Sep 9, 2023

Agreeing with @grovesNL here. We should only really expose handles that directly interact with GPU APIs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants