The rendering section describes what happens every time a new frame of animation is rendered. This will occur every time the user clicks and drags within the canvas
First, we compose matrices for the persective, view, and model transformations. The textbook's matrix library helps. This example chooses a field-of-view of 45°, an aspect ratio of 1, and a depth range from 1 to 10.
These are delivered to the vertex shader via the uniforms we configured.
Finally, having finished with the uniforms, move on to configure the attributes. Each of the array buffers contains a list of 3-component floating point vectors.
With all configuration in place, we can finally render. Begin by clearing the screen, make sure the depth test is enabled, and finish by drawing the contents of the triangle element buffer.