Skip to content

Commit

Permalink
updated the usage.txt file
Browse files Browse the repository at this point in the history
  • Loading branch information
rhulha committed Aug 16, 2014
1 parent f2fc232 commit e0330c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ Some basic ideas:
* Node extends Spatial
* Mesh extends Node
* Nodes can contain child nodes and they inherit their parents transformation.

See doc/usage.txt for usage infos.

11 changes: 7 additions & 4 deletions doc/usage.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

create a new Dart web project, add this as a pubspec.yaml dependency:
dependencies:
ChronosGL: any
chronosgl: any

(The package name has switched to all lowercase!)

create a HTML page and add a canvas similar to this:
<body style="height:100%; margin: 0; padding: 0">
Expand All @@ -12,19 +13,21 @@ in your dart file add this:
import 'package:chronosgl/chronosgl.dart';

void main() {
ChronosGL chronosGL = new ChronosGL('#webgl-canvas', false);
ShaderProgram prg = chronosGL.createProgram( 'FixedVertexColor', chronosGL.getShaderLib().createFixedVertexColorShader());
ChronosGL chronosGL = new ChronosGL('#webgl-canvas');
ShaderProgram prg = chronosGL.createProgram( createDemoShader());
Camera camera = chronosGL.getCamera();
camera.setPos( 0.0, 0.0, 56.0 );
Mesh m = chronosGL.getUtils().createTorusKnotMesh();
prg.add( m);
chronosGL.run();
}

Press play to test.

If you need dart:html, it is recommended to add dart:html as HTML like this, due to a naming conflict regarding Node:
import 'dart:html' as HTML;

Some other useful imports:
Some other imports you might find useful:

import 'dart:web_gl';
import 'dart:math' as Math;
Expand Down

0 comments on commit e0330c1

Please sign in to comment.