gl_dart 0.2.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 61

OpenGL Dart #

dart:ffi bindings for OpenGL

Install #

Add this to pubspec.yaml:

dependencies:
  gl_dart: ^0.2.0

Import it:

import 'package:gl_dart/gl.dart';

Notice #1: C:\Windows\System32\opengl32.dll or /usr/lib/x86_64-linux-gnu/libGL.so will be automatically opened using OpenGL 4.0.

For manual OpenGL initialization:

import 'package:gl_dart/gl_dart.dart';
Gl gl = new Gl(
  customPath: '<path-to-gl-file>',
  version: GlVersion.GL_VERSION_X_X
);
//...

Notice #2: on Windows wglGetProcAddress is used

Alternatives #

Changelog #

[0.2.1] - 02.07.2020 #

  • gl_dart/gl_dart.dart library name hotfix.

[0.2.0] - 02.07.2020 #

Added #

  • gl_dart/gl_dart.dart for manual initialization of the OpenGL.

[0.1.0] - 12.02.2020 #

Changed #

  • Autoformatting
  • The experiments with the OpenGL API are finished. OpenGL extensions remain to be considered.

[0.0.1+1] - 13.02.2020 #

Added #

  • Example

Changed #

  • Formatting
  • Minor fixes
  • Package description

[0.0.1] - 12.02.2020 #

Added #

  • Bindings for OpenGL 1.1 - 4.6
  • Windows and Ubuntu only supported

example/main.dart

import 'package:gl_dart/gl.dart';

void main() {
  try {
    // Loading OpenGL v3.3
    gl = Gl(version: GlVersion.GL_VERSION_3_3);
  } catch (e) {
    // oops! could not find or load opengl.
    print(e);
  }

  // ...
}

Use this package as a library

1. Depend on it

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


dependencies:
  gl_dart: ^0.2.1

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:gl_dart/gl_dart.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
23
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.14

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because:

  • package:gl_dart/gl_dart.dart that imports:
  • package:gl_dart/src/core/glext_pfn_typedefs.dart that imports:
  • package:gl_dart/src/core/glext_structures.dart that imports:
  • dart:ffi

Package not compatible with runtime js

Because:

  • package:gl_dart/gl_dart.dart that imports:
  • package:gl_dart/src/core/glext_pfn_typedefs.dart that imports:
  • package:gl_dart/src/core/glext_structures.dart that imports:
  • dart:ffi

Health issues and suggestions

Document public APIs. (-0.97 points)

4871 out of 4876 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
ffi ^0.1.3 0.1.3
Dev dependencies
test ^1.12.0