User:Lindsaystanleykay/SceneJS

SceneJS is a JavaScript framework that allows interactive 3-dimensional scenes to be created on the WebGL HTML5 canvas element.

Its scene graphs are defined in a terse, declarative style. Below is a an example which renders the OpenGL teapot. To render the teapot, SceneJS will traverse the scene graph in depth-first order. Each scene node is a function that will set some OpenGL state on entry, then un-set it again before exit. In this scene, a renderer node activates a WebGL Canvas element and clears depth and colour buffers, a shader activates some OpenGL Shading Language (GLSL) scripts, and the rest of the nodes set various matrices, vectors and geometry variables within the scripts.

Note that node declarations generally have the form node({configs}, child,child...). For brevity, node configurations need only specify values where defaults are overridden, such as non-zero vector components, for example.