dartgl 0.1.3

  • README.md
  • Installing
  • Versions
  • 61

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

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

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages 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...

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
45 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
42 / 100
Overall score:
Weighted score of the above. [more]
61

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:dartgl/dartgl.dart.

Suggestions

  • Maintain CHANGELOG.md.

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

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