Many small reusable WebGL modules
Uses npm/browserify
Bottom-up instead of top-down
Small modules => well-defined problems; smaller bundles; fewer bugs; simpler, better solutions
Small abstractions over WebGL
Reduce boilerplate, smooth rough edges
Standard interface: .bind()/.update()/.dispose()
//diffuse.glsl
float diffuseLight(vec3 lightDir, vec3 normal) {
return max(0.0, dot(lightDir, normal));
}
#pragma glslify: export(diffuseLight)
//fragment.glsl
precision mediump float;
uniform vec3 lightDirection, surfaceColor;
varying vec3 normal;
#pragma glslify: diffuse = require('./diffuse.glsl')
void main() {
float intensity = diffuse(lightDir, normal);
gl_FragColor = vec4(intensity * color, 1.0);
}
Prefer flat arrays/matrices over "cute" vector classes
Easier to interface with, lower overhead, no peer dependency
Based on gl-matrix by Brandon Jones
Flexible and efficient data structure
Large library ecosystem
Store geometry, not drawing commands/scene information
I am looking at *you* Collada/VRML!
Prefer simplicial complexes:
{
cells:
[ [ 0, 1, 2 ],
[ 0, 2, 3 ],
[ 0, 3, 1 ],
[ 1, 3, 2 ] ],
positions:
[ [ 1, 1, 1 ],
[ 1, -1, -1 ],
[ -1, 1, -1 ],
[ -1, -1, 1 ] ]
}
Better debugging and testing tools
Find abstractions for multipass effects
More stuff! Lighting, geometry, etc.
IRC: #stackgl on freenode
Twitter/GitHub: @stackgl
Thanks for your time!