Hey!
I'm building a Camera2 app which renders filters. I want to use Skia + SKSL for this, so I set up two android.view.Surfaces:
1. An offscreen surface I created with OpenGL's eglCreatePbufferSurface
2. An onscreen surface which I receive from the SurfaceView view, and then convert it to an OpenGL surface using eglCreateWindowSurface
I then use MakeFromBackendRenderTarget to wrap the OpenGL Surfaces to two Skia Surfaces, inputSurface and outputSurface.
Initialization runs fine and without any OpenGL errors, but I am not sure how I can draw the contents of the first surface (offscreen) into the second surface (onscreen) in my Frame Received Callback.
Also, I can draw stuff onto the first surface (offscreen) without anything crashing (I'm just not sure if it works as I can't see anything yet), but once I draw onto the second surface (onscreen) it crashes with the following error: "Unable to update texture contents"
Should I use one OpenGL context for everything?
Surely I can't just do something like:
// take snapshot of offscreen context
_inputSurface->flushAndSubmit();
auto image = _inputSurface->makeImageSnapshot();
// write that to onscreen context
_outputSurface->getCanvas()->drawImage(image, 0, 0);
// (do shader here)
_outputSurface->flushAndSubmit();
, right?