gl_canvas 1.0.0 copy "gl_canvas: ^1.0.0" to clipboard
gl_canvas: ^1.0.0 copied to clipboard

outdated

A OpenGLES context canvas in flutter.

gl_canvas #

A OpenGLES context canvas in flutter.

Usage #

// New a GLCanvas require a builder
GLCanvas(
    builder: _builder,
)

The builder should return a GLCanvasController. and the builder must be a top level function or a static function.

class CanvasController extends GLCanvasController {
    LibOpenGLES gl = LibOpenGLES(
      Platform.isAndroid ?
      DynamicLibrary.open("libGLESv2.so"):
      DynamicLibrary.process()
  );


    @override
    bool shouldRender(GLContext ctx, int tick) => false;

    void onFrame(GLContext ctx, int tick) {
        gl.glClearColor(0, 1.0, 0, 1.0);
        gl.glClear(GL_COLOR_BUFFER_BIT);
        //...
    }

    @override
    void dispose() {}
}

GLCanvasController is running on a isolate, in this isolate you can use the OpenGLES API directly. In my example I using opengl_es_bindings to call the OpenGLES.

9
likes
0
points
162
downloads

Publisher

unverified uploader

Weekly Downloads

A OpenGLES context canvas in flutter.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

ffi, flutter

More

Packages that depend on gl_canvas