flutter gl
flutter gl can call opengl es api with dart
support ios,android,web
opengl es api
now the api is similar to webgl
how to use
now this is only support draw to fbo. then share the fbo texture to native side.
import
import 'package:flutter_gl/flutter_gl.dart';
usage
int width = 200;
int height = 200;
num dpr = 1.0;
flutterglplugin = flutterglplugin(width, height, dpr: dpr);
map<string, dynamic> _options = {
"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);
run examples
download or download this repo
cd flutter_gl/flutter_gl/example
flutter run
Comments are closed.