dartgl 0.1.3

  • README.md
  • Installing
  • Versions
  • 0

DartGL

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
dependencis:
  dartgl: 
  • 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");
  
  glLinkProgram(program);
  location = glGetUniformLocation(program, "in_Time");
    
  var arrays = new Uint32List(1);
  glGenVertexArrays(1, arrays);
  ...
  
  while (...){

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  
    ...
    /.
}

Notes

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.

Examples

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

Debug

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';

To-Do

  • 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:


dependencies:
  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...

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

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Health issues and suggestions

Document public APIs (-9.76 points)

5371 out of 5502 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Fix lib/dartgl_sdl.dart. (-3.93 points)

Analysis of lib/dartgl_sdl.dart reported 8 hints, including:

line 192 col 7: Name types using UpperCamelCase.

line 206 col 7: Name types using UpperCamelCase.

line 212 col 7: Name types using UpperCamelCase.

line 225 col 7: Name types using UpperCamelCase.

line 237 col 7: Name types using UpperCamelCase.

Fix lib/debug/handlers.dart. (-1 points)

Analysis of lib/debug/handlers.dart reported 2 hints:

line 3 col 16: The type of the function literal can't be inferred because the literal has a block as its body.

line 7 col 15: The type of the function literal can't be inferred because the literal has a block as its body.

Format lib/dartgl.dart.

Run dartfmt to format lib/dartgl.dart.

Format lib/debug/dartgl.dart.

Run dartfmt to format lib/debug/dartgl.dart.

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-50 points)

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

Package is too old. (-100 points)

The package was released more than two years ago.

Maintain CHANGELOG.md. (-20 points)

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

Maintain an example. (-10 points)

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.