opengl 0.3.0

OpenGL FFI #

OpenGL 4.6 FFI bindings for Dart. Supports Windows, Linux and macOS desktops.

0.3.0 #

  • add macOS support

0.2.0+1 #

  • use ffi_utils

0.1.0+2 #

  • add GLFW example

0.1.0+1 #

  • add change log
  • add example

0.1.0 #

  • first version


import 'package:opengl/opengl.dart';

void main() {
  // create OpenGL context and make it current

  // load OpenGL dynamic library and init all its functions

  // use OpenGL
  var result = glGetError();

  // glGetError returns GL_NO_ERROR if successful, 
  // or GL_INVALID_OPERATION = 0x0502 (1282) without context in our case
  print('glGetError() result is ${result == GL_NO_ERROR ? "GL_NO_ERROR" : result}');

Use this package as a library

1. Depend on it

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

  opengl: ^0.3.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or 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:opengl/opengl.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health issues and suggestions

Document public APIs. (-1 points)

6115 out of 6115 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/src/opengl_header.dart.

Run dartfmt to format lib/src/opengl_header.dart.

Format lib/src/opengl_init.dart.

Run dartfmt to format lib/src/opengl_init.dart.

Format lib/src/opengl_library.dart.

Run dartfmt to format lib/src/opengl_library.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
ffi_utils ^0.1.0 0.1.0
Transitive dependencies
ffi 0.1.3
Dev dependencies
glfw ^0.2.0
pedantic ^1.0.0