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