flutter_gl
1.0.0
DART通過DART:FFI跨平台調用OpenGL API。為OpenGl提供紋理窗口小部件的顫動。
支持iOS,Android,Web,MacOS,Windows
Linux todo
由三_ dart使用
API類似於WebGL
僅支持FBO的支持。然後將FBO紋理共享到本地側。
import 'package:flutter_gl/flutter_gl.dart';
int width = 200;
int height = 200;
num dpr = 1.0;
flutterGlPlugin = FlutterGlPlugin();
Map<String, dynamic> _options = {
"width": width,
"height": height,
"dpr": dpr,
"antialias": true,
"alpha": false
};
await flutterGlPlugin.initialize(options: _options);
// on web this need called after web canvas dom was added to document
await flutterGlPlugin.prepareContext();
// you can get gl by
gl = flutterGlPlugin.gl;
// then you can call OpenGL ES API by gl like
gl.clearColor(0.0, 0.0, 0.0, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
// use this method to notify Flutter update Texture Widget
// sourceTextue is a texture which bind to FBO framebuffer
flutterGlPlugin.updateTexture(sourceTexture);
DART列表轉換為FFI指針需要模因副本。
克隆或下載此倉庫
cd flutter_gl/flutter_gl/example
flutter run
啟動插件時,請與threeegl保存共享OpenGL上下文,
ThreeEgl.setContext("shareContext", shareEglEnv.eglContext);
因此,您可以使用threegl lib獲得它,然後與“ ShareContext”共享OpenGL上下文
shareContext = ThreeEgl.getContext("shareContext");
對於ios,密鑰是3 ...
eAGLShareContext = ThreeEgl.getContext(key: 3);
不需要 ?只是webgl
不支持立即獲得共享上下文
檢查示例項目複製示例/android/app/libs/aars/threeegl.aar到您的應用程序Android Project相同路徑
更改Minsdkversion 24


提交任何問題,錯誤或功能請求。
請拉請請求!