HTML and CSS Reference
In-Depth Information
If you want to learn more about JavaScript's prototype-based inheritance, pick up a copy
of John Resig and Bear Bibeault's Secrets of the JavaScript Ninja (Manning, 2012). It's
loaded with great techniques to help you work with libraries, create cross-browser solu-
tions, and maintain your code.
To create 3D shape objects, you also need to send the graphics card some packaged matrix
information, such as [0 1 3 0] , but JavaScript doesn't have built-in tools for hand-
ling such information. You could write a matrix processing library for your engine from
scratch, but it's quite a lot of work. Instead, you'll use sylvester.js to process everything.
Get the latest version of the script from , unzip it, and include
the sylvester.js file in your assets folder.
The last asset you need is webgl_util.js, which contains lots of prewritten code to help with
generating a perspective, processing matrixes, and more. We wish we could credit the au-
thor of this great script, but as Mozilla says, “Nobody seems entirely clear on where it came
from.” Grab the file at and place it in assets.
Wait—didn't you say “custom rolled engine”?
Earlier we said that our WebGL tutorial centers on a built-from-scratch engine, which may
lead you to ask, “Why are you making me use assets that aren't from scratch?” Truth is,
we don't have time to custom roll everything; it would take at least 100 more pages to ex-
plain a complete engine step by step, so we thought that adding a few scripts to simplify
everything was a good idea. We hope you agree!
9.1.2. Tools to create, alter, and delete objects
With your assets in place, let's get to work on the engine.
Search WWH ::

Custom Search