Llame a la plataforma cruzada API OpenGL por DART a través de DART: FFI. Proporciona OpenGL con un widget de textura en Flutter.
Admitir iOS, Android, Web, MacOS, Windows
Linux TODO
Usado por tres_dart
La API es similar a WebGL
Solo soporte Draw to FBO. Luego comparta la textura FBO al lado nativo.
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);
Lista de dardos Convertir a FFI Pointer Need Memeory Copy.
Clon o descargar este repositorio
cd flutter_gl/flutter_gl/example
flutter run
Cuando se inicie el complemento, guarde el contexto compartido de OpenGL con tresEGL,
ThreeEgl.setContext("shareContext", shareEglEnv.eglContext);
Para que pueda obtenerlo, use treseGl libl, luego cree un contexto de OpenGL Compartir con "ShareContext"
shareContext = ThreeEgl.getContext("shareContext");
Para iOS la llave es 3 ...
eAGLShareContext = ThreeEgl.getContext(key: 3);
No hay necesidad ? Solo webgl
no admitir obtener el contexto de compartir ahora
Verifique el proyecto de ejemplo Copie el ejemplo/Android/App/Libs/Aars/ThreeGl.AAR en su aplicación Android Project misma
Cambiar minsdkversion 24


Presentar cualquier problema, errores o solicitudes de funciones.
¡Solicite la solicitud por favor!