HTML and CSS Reference
In-Depth Information
What Does a WebGL Application Look Like?
Now we are going to show you a WebGL application demo that rotates a 3D cube on Canvas
(see Figure 11-2 ) . Because we are not experts in 3D graphics, we will forgo our practice of
describing every line of code in the example; instead, we will highlight interesting sections of
code to help you understand what is happening.
ThisdemoisbasedonLesson4from Giles Thomas'sLearning WebGLwebsite .While thisis
only one short demo, it should give you a very good idea of how to structure and build code
for a WebGL application.
NOTE
Much of this code has been adapted from the work of Giles Thomas with his express written permis-
sion.
Figure 11-2. 3D rotating cube (CH11EX1.html)
JavaScript libraries
First,weaddsomeJavaScriptlibraries.ModernizrincludesatestforWebGLsupportinaweb
browser. This version was freshly released, but it could be updated with new features at any
Search WWH ::




Custom Search