HTML and CSS Reference
In-Depth Information
Step 1: Use matrices and buffers to visually output information
Let's start step 1 by opening core.js and replacing gd.core.draw() with listing 9.13 .
The listing will clear out the canvas's previous draw data and set the current perspective
to draw all entities currently in storage. For all of the entities, it will run their update and
rotation logic if it's configured. Be careful with the for loop in this listing, because it's
continued for two more listings (up to listing 9.15 ) .
Listing 9.13. core.js—Drawing shapes [ 3 ]
3 Weisstein, Eric W., “Identity Matrix,” MathWorld, a Wolfram Web Resource, http://mng.bz/CO1M .
Step 2: Bind and draw shapes
With the matrix set up properly and rotation applied, you need to output the buffer inform-
ation for the current 3D object. Do this by binding 3D data and then outputting it through
 
 
Search WWH ::




Custom Search