dartgl 0.1.3

  • README.md
  • Installing
  • Versions
  • 11

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]
22
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]
11
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.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.