Create GrDirectContext from current WASM/WebGL context?

27 views
Skip to first unread message

Rex Guo

unread,
Feb 21, 2024, 8:51:41 AMFeb 21
to skia-discuss
I'm trying to render multiple Skottie animation instances in my WASM/WebGL app. Each animation requires its own SkCanvas (backed by a GL texture). I'm having difficulty creating the SkSurface instances (to get the SkCanvas) using SkSurfaces::WrapBackendTexture(...) as the method requires a GrDirectContext. From the sources, I don't see a way to get a GrDirectContext from the current existing WebGL context.

Alternatively, I tried creating a new GrDirectContext for each animation instance using GrDirectContext::MakeGL() but I get this WebGL error instead:
WebGL: INVALID_ENUM: getParameter: invalid parameter name, WEBGL_debug_renderer_info not enabled
_glGetString @ test.js:7489
$GrGLFunction<unsigned char const* (unsigned int)>::GrGLFunction(unsigned char const* (*)(unsigned int))::'lambda'(void const*, unsigned int)::__invoke(void const*, unsigned int)


Any help is appreciated!

Reply all
Reply to author
Forward
0 new messages