dartgl 0.1.3

  • README.md
  • Installing
  • Versions
  • 43


It is a native extension for Dart to use OpenGL in desktop applications. On www.dartlang.org they call it "command-line or server applications". However, you can definitely create GUI application and use OpenGL too.

Support matrix

  • OpenGL: 3.3-4.5 core profile
  • OS: Linux 64-bit and Windows 32|64-bit
  • Dart: any

How to install

  • Add to pubspec.yaml
  • Run
pub get

How to use

  • Add to your Dart file
import 'package:dartgl/dartgl.dart';
  • Create OpenGL context (see Notes)
  • Just use OpenGL functions and constants
  var vertexShader = glCreateShader(GL_VERTEX_SHADER);
  var fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
  var program = glCreateProgram();
  glAttachShader(program, vertexShader);
  glAttachShader(program, fragmentShader);
  glBindAttribLocation(program, 0, "in_Position");
  glBindAttribLocation(program, 1, "in_Color");
  glBindAttribLocation(program, 2, "in_Texture");
  location = glGetUniformLocation(program, "in_Time");
  var arrays = new Uint32List(1);
  glGenVertexArrays(1, arrays);
  while (...){



For testing purpose, I created native extension for a tiny part of SDL 2.0 to create a window, create OpenGL context and manage window events. You can use your own way.


In order to run basic examples from test directory, SDL should be installed.

  • Linux
sudo apt-get install libsdl2-2.0
  • Windows

Download and add to PATH


In order to simplify troubleshooting, you can use debug modification of DartGL. In this mode, glGetError() is called after each OpenGL. Error message is printed to console if glGetError returns not GL_NO_ERROR.

import 'package:dartgl/debug/dartgl.dart';


  • Improve performance
  • Improve tests
  • MacOS X support
  • OpenGL ES support

Use this package as a library

1. Depend on it

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

  dartgl: "^0.1.3"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

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

3. Import it

Now in your Dart code, you can use:

      import 'package:dartgl/dartgl.dart';
Version Uploaded Documentation Archive
0.1.3 Aug 15, 2016 Go to the documentation of dartgl 0.1.3 Download dartgl 0.1.3 archive
0.1.2 Aug 12, 2016 Go to the documentation of dartgl 0.1.2 Download dartgl 0.1.2 archive
0.1.1 Aug 2, 2016 Go to the documentation of dartgl 0.1.1 Download dartgl 0.1.1 archive
0.1.0 Aug 2, 2016 Go to the documentation of dartgl 0.1.0 Download dartgl 0.1.0 archive
0.0.23 Aug 13, 2014 Go to the documentation of dartgl 0.0.23 Download dartgl 0.0.23 archive
0.0.22 Aug 13, 2014 Go to the documentation of dartgl 0.0.22 Download dartgl 0.0.22 archive
0.0.21 Aug 12, 2014 Go to the documentation of dartgl 0.0.21 Download dartgl 0.0.21 archive
0.0.20 Aug 12, 2014 Go to the documentation of dartgl 0.0.20 Download dartgl 0.0.20 archive
0.0.19 Aug 12, 2014 Go to the documentation of dartgl 0.0.19 Download dartgl 0.0.19 archive
0.0.18 Aug 12, 2014 Go to the documentation of dartgl 0.0.18 Download dartgl 0.0.18 archive

All 27 versions...


We analyzed this package on Jun 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
21 / 100
Code health derived from static analysis. [more]
100 / 100
Reflects how tidy and up-to-date the package is. [more]
14 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: other

Primary library: package:dartgl/dartgl.dart with components: nativewrappers.


  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Package is getting outdated.

    The package was released 95 weeks ago.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 14 hints.

    Run dartfmt to format lib/dartgl.dart.

    Run dartfmt to format lib/dartgl_sdl.dart.

    Similar analysis of the following files failed:

    • lib/debug/dartgl.dart (hint)
    • lib/debug/handlers.dart (hint)
  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use dartgl.dart.