Chapter 08 · Dart + browser APIs
Shaders and matrices, directly from Dart.
Compile shaders, upload a colored cube, compute perspective and rotation matrices, and animate WebGL without a 3D JavaScript library.
Starting WebGL…
How it works
The HTML is a static template. JSON supplies values or drawing data. Dart owns rendering and browser events; boot.js registers small JavaScript handlers through LMDart.register.
final cube = WebglCube(canvas,
await fetchJson('data/webgl.json'));
cube.start();
cube.toggle();
cube.reset();