The CPU and the GPU

When rendering, we may choose what data is used and how it is displayed. In this case, we'll start with vertex 0, the first one, and display all of the elements in the array as TRIANGLES.

gl.drawElements(gl.TRIANGLES, triangleArray.length, gl.UNSIGNED_SHORT, 0);

The number of elements is given by the length of the array, and the type of each element is UNSIGNED_SHORT because we converted the JavaScript array to a Uint16Array.

Now, because the GPU knows the type and layout of the data, it can step down the rows, processing each in turn.