Skip to content

Is there a way to initialize WGPU with HTMLCanvas/WebGlRenderingContext? #2893

Answered by grovesNL
Umenokin asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Umenokin! 👋

You should be able to pass a WebGlRenderingContext using instance.create_surface_from_canvas

pub fn create_surface_from_canvas(&self, canvas: &web_sys::HtmlCanvasElement) -> Surface {
when you're using the wasm target.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Umenokin
Comment options

Answer selected by Umenokin
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants