After parsing and displaying the data from a single stock, we will now display the data from multiple stocks in a single scene. The level of programming jumps significantly when we grow from showing just a single stock value to showing two or more. We shall do this now by showing data from five stocks.
Not surprisingly, growing from displaying one stock to five stocks means that we have to deploy an array constructed with the global variable var stockBoxObject = [];
. We will build the boxes that will represent our stock data inside webGLStart()
:
stockBoxObject[0] = AddMeshObject("texturedBox0", "texturedBox.obj",[-5.5, -3.0, -16.0], [1, 1, 1], [0, 0, 0], false ); …… stockBoxObject[4] = AddMeshObject("texturedBox4", "texturedBox.obj",[5.5, -3.0, -16.0], [1, 1, 1], [0, 0, 0], false );
The boxes are numbered 0 to 4, but only the first box (number 0) and the last box (number 4) are shown in the code, with boxes 1, 2, and 3 having similar code. There...