updateTexture method

Future<void> updateTexture(
  1. FlutterAngleTexture texture, [
  2. WebGLTexture? sourceTexture
])

Implementation

Future<void> updateTexture(FlutterAngleTexture texture, [WebGLTexture? sourceTexture]) async {
  if(_disposed) return;
  updateSource(texture,sourceTexture);


  // If we have an iOS EGL surface created from IOSurface, use it
  if (_useSurface && texture.surfaceId != nullptr) {
    _libEGL!.eglSwapBuffers(_display, texture.surfaceId!);
  }
  else{
    gl.glFlush();
    gl.glBindFramebuffer(GL_FRAMEBUFFER, 0);
    assert(_activeFramebuffer != null, 'There is no active FlutterGL Texture to update');
  }

  if (!Platform.isAndroid) {
    if (Platform.isLinux || Platform.isWindows) {
      _channel.invokeMethod('textureFrameAvailable', {"textureId": texture.textureId});
    }
    else {
      await _channel.invokeMethod('textureFrameAvailable', {"textureId": texture.textureId});
    }
  }
}