Share context for custom engine (CanvasKit, WebGL)

21 views
Skip to first unread message

Andrew Varga

unread,
Jul 3, 2022, 5:43:11 AMJul 3
to skia-discuss
Hi all! I'm curious if it's possible to use skia / CanvasKit in a way that it acts as a "helper" / complementary tool for a custom WebGL engine.
For example if I only want to use CanvasKit for drawing text, what would be the best way to get that rendering result back into my engine's WebGL context?
Would it be possible somehow for my engine to share the same WebGL context as CanvasKit is using and then either draw the text into a Texture via a Framebuffer or into its canvas directly?
In the worst case, if the context cannot be shared I can read the pixels from the canvas/context CanvasKit is using into a javascript arraybuffer, and then upload that into a texture for my engine to render - but this would be pretty slow so probably not efficient to do on a per frame basis.

Alternatively, if this would become easier more directly without CanvasKit and having the custom engine targeting wasm (but still deploying to the web), that could be interesting too.

Thank you,
Andrew
Reply all
Reply to author
Forward
0 new messages