This is part of the code for a Flutter plugin that uses a Flutter texture to render something with OpenGL
private FlutterVideoPlugin(Registrar registrar, MethodChannel channel) {
this.registrar = registrar;
this.channel = channel;
this.textures = registrar.textures();
}
@Override
public void onMethodCall(MethodCall call, Result notSafeResult) {
final AnyThreadResult result = new AnyThreadResult(notSafeResult);
if (call.method.equals("createVideoRenderer")) {
TextureRegistry.SurfaceTextureEntry entry = textures.createSurfaceTexture();
//do anything with the texture
As you see, it uses a Flutter methodCall.
Is it possible to do the same thing but with FFI in C++? I'd not like to rely on onMethodCall
, it's gotta be either FFI or Flutter method calls, because I think that FFI does everything in a different way, something like that.
However, since the Flutter engine and specially the Texture part is written in Java, it looks like I need some java code. The problem is that FFI and java don't mix. It looks like I either have to use onMethodCall
for everything in my app, or FFI, but FFI does not seem to have support for getting textures