Originally, when I first started writing this book, I had intended on only covering the 2D context of the HTML5 canvas (I strongly believe that most people who use canvas will be working with this context). I had also originally intended on covering techniques for rendering 3D shapes in the 2D context using 3D projection methods and vector operations. People were already busy creating some pretty incredible 3D JavaScript libraries for the 2D context, including Kevin Roast's K3D library (one of the reviewers of this book), and also Dean McNamee's Pre3d library.
As I neared writing this chapter, WebGL—a true 3D context—began to dominate 3D canvas demos across the Web. WebGL stands for Web-Based Graphics Library, and it's based on OpenGL ES 2.0 which provides an API for 3D graphics. Because WebGL leverages hardware acceleration by pushing buffers directly onto the graphics card to render 3D models, it performs much better than its 2D context, 3D projection library counterparts....