diff --git a/src/bindings/wasm/tvgWasmLottieAnimation.cpp b/src/bindings/wasm/tvgWasmLottieAnimation.cpp index fee1e9b9..693d20dd 100644 --- a/src/bindings/wasm/tvgWasmLottieAnimation.cpp +++ b/src/bindings/wasm/tvgWasmLottieAnimation.cpp @@ -188,7 +188,7 @@ struct TvgWgEngine : TvgEngineMethod struct TvgGLEngine : TvgEngineMethod { - EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = 0; + intptr_t context = 0; ~TvgGLEngine() override { #ifdef THORVG_GL_RASTER_SUPPORT diff --git a/src/renderer/gl_engine/tvgGlRenderer.cpp b/src/renderer/gl_engine/tvgGlRenderer.cpp index 675e56fa..29f75975 100644 --- a/src/renderer/gl_engine/tvgGlRenderer.cpp +++ b/src/renderer/gl_engine/tvgGlRenderer.cpp @@ -797,7 +797,7 @@ bool GlRenderer::target(void* context, int32_t id, uint32_t w, uint32_t h) //assume the context zero is invalid if (!context || id == GL_INVALID_VALUE || w == 0 || h == 0) return false; - currentContext(); + if (mContext) currentContext(); flush(); @@ -808,6 +808,8 @@ bool GlRenderer::target(void* context, int32_t id, uint32_t w, uint32_t h) mContext = context; mTargetFboId = static_cast(id); + currentContext(); + mRootTarget = GlRenderTarget(surface.w, surface.h); mRootTarget.setViewport({0, 0, static_cast(surface.w), static_cast(surface.h)}); mRootTarget.init(mTargetFboId);