Skottie Rendering to frame buffer - Strange behaviour

113 views
Skip to first unread message

Ranjith pillai

unread,
Nov 3, 2023, 1:15:38 PM11/3/23
to skia-discuss
Hi Skia Community,

I am trying to render skottie animation to an offscreen surface. I modified the skottielib
platform_tools\android\apps\skottie\skottielib\src\main\cpp
to pass a FBO to the DrawFrame jni function

extern "C" JNIEXPORT bool
JNICALL
Java_org_skia_skottie_SkottieAnimation_nDrawFrame(JNIEnv *env, jclass clazz,
jlong nativeProxy, jint width,
jint height,
jboolean wideColorGamut,
jfloat progress,
jint backgroundColor,
jboolean forceDraw,
jint fboID) {


GrGLFramebufferInfo fboInfo;
fboInfo.fFBOID = fboID;

auto backendRT = GrBackendRenderTargets::MakeGL(width, height, 0, STENCIL_BUFFER_SIZE, fboInfo);
sk_sp<SkSurface> renderTarget(SkSurfaces::WrapBackendRenderTarget(
dContext, backendRT, kBottomLeft_GrSurfaceOrigin, colorType, nullptr, &props));

auto canvas = renderTarget->getCanvas();
canvas->clear(backgroundColor);

If I clear the canvas with background color it works well. I was able to confirm the background color inside the texture which is associated with FBO.
But if I call 
skottieAnimation->mAnimation->render(canvas, &bounds);
Skottie Animation does not gets rendered to FBO, also messes up my subsequent opengl rendering pipeline outside skia. Please suggest the reason for this strange behaviour. The return value of mAnimation->render is TRUE

Regards,
Ranjith





Duong Nguyen

unread,
Dec 19, 2025, 10:07:43 AM (yesterday) Dec 19
to skia-discuss
Hi, it's been a while but currently I'm facing the same problem as yours. Did you find a solution for this? Can you share it with me?
Reply all
Reply to author
Forward
0 new messages