Game Development Reference
In-Depth Information
Libraries
Rather than reinvent functionality, there are several excellent matrix libraries available for use with
WebGL. There are also many higher-level graphics engines and APIs available.
Matrix libraries
Matrix operations—addition, multiplication, inverse, and so forth— are essential in 3D graphics for
calculating transforms. They are also used in image processing as convolution masks and filters. Some
existing JavaScript matrix libraries include the following:
CanvasMatrix.js : http://code.google.com/p/webglsamples/source/browse/
collectibles/script/CanvasMatrix.js
glMatrix : https://github.com/toji/gl-matrix
Sylvester : http://sylvester.jcoglan.com/
webgl-mjs : http://code.google.com/p/webgl-mjs/
Of
these,
glMatrix
claims
to
be
the
fastest
and
offers
some
benchmarks
at
http://glmatrix.googlecode.com/hg/benchmark/matrix_benchmark.html .
Higher-level APIs
This chapter will focus on explaining how to set up a basic scene and will not use a higher-level API.
Frameworks can abstract basic scene set up and functionality, increasing productivity. Learning WebGL
without a higher-level library can help you appreciate using one later on. Knowing the lower-level functions
can also aid in understanding and increase performance.
For completeness, we will list some existing frameworks. At the time of writing, there are over twenty well-
used frameworks, which have varying purposes. A complete list is available at
www.khronos.org/webgl/wiki/User_Contributions.
The following highlights some popular libraries that have distinct uses:
GLGE ( www.glge.org ): Described as “WebGL for the lazy” its web site reads “The aim of GLGE is
to mask the involved nature of WebGL from the web developer, who can then spend his/her time
creating richer content for the web.”
O3D ( http://code.google.com/p/o3d ): Originally a browser plug-in, this is a Google library with
COLLADA model support on top of the WebGL framework
SceneJS ( www.scenejs.com ): Scene graphs and CAD with WebGL
TDL ( https://github.com/greggman/tdl ): Low level; rendering speed is valued over ease of use;
first used on Google Body and other high-performance WebGL demos
Three.js ( https://github.com/mrdoob/three.js ): A lightweight 3D engine with a high level of
GitHub user activity
 
Search WWH ::




Custom Search