flutter_opengl 0.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 44

OpenGL Flutter plugin #

OpenGL Android NDK plugin.

YT video

Image

Getting Started #

This plugin is only for Android. Is greatly appreciated any help!
This is an early stage of a plugin for Flutter to let the developers to use an OpenGL widget. This is not a binding to let the devs to write OpenGL code within Flutter, but lets to write shader and drawing frame functions in C/C++ code. The plugin is only available for Android OS, looking forward for someone to make it cross-platform!

The example provides 4 drawing shaders classes. They are subclass of Shader.cpp. Each of them need an initShader(void *args) and a drawFrame(void *args) functions which are used by the renderer.cpp engine at creation time. RendererController::nativeSetSurface() has the task to crate the renderer engine.

The 3 example shaders are taken from https://www.shadertoy.com/ https://www.shadertoy.com/view/3l23Rh by nimitz https://www.shadertoy.com/user/nimitz https://www.shadertoy.com/view/llj3Dz by Darthmarshie https://www.shadertoy.com/user/Darthmarshie https://www.shadertoy.com/view/ttlGDf by alro https://www.shadertoy.com/user/alro

(more to come)

ISSUEs: #

Currently NDK builds for x86_64, x86, arm64-v8a and armeabi-v7a and libnative-lib.so is available on all ABI lib subfolders but libflutter.so is missing in armeabi-v7a. In example or plugin build.gradle or both, forcing gradle to build only for armeabi-v7a with

ndk {
    abiFilters 'armeabi-v7a'
}

doesn't work and libflutter.so is missing in the lib folder, but works with command line:

flutter run --debug --target-platform android-arm

(more to come)

TODO: #

Renderer::getWindowWidth() and Renderer::getWindowHeight() doesn't work correctly:
they are used in Renderer::initializeGL() to set window buffer size with ANativeWindow_setBuffersGeometry(), without it the window surface is not working and nothing is displayed.


Add source comments.


Implement a way to pass an OpenGL texture from Flutter to NDK.


Implement iOS layer plugin.

(more to come)

0.0.3 #

  • code rearranged.
  • every shader can now be written separately subclassing the Shader class and passing it to the renderer.
  • added function to load texture image from assets folder with Android. Since this uses java, it should be rewritten for iOS.
  • added a texture shader example.

example/README.md

opengl_example #

Demonstrates how to use the opengl plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_opengl: ^0.0.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_opengl/flutter_opengl.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
44
Learn more about scoring.

We analyzed this package on Oct 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

8 out of 8 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/flutter_opengl.dart.

Run flutter format to format lib/flutter_opengl.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test