Drawing the Initial Frame

Compile and link the OpenGL program, setup the array buffers for each set of vertices, and draw an initial frame with no translation for the second triangle.

237                 // Here we create and compile the vertex shader. This will compile to code for your specific
238                 // graphics card.
239                 var vertexShader    = compileShader(gl, vertexShaderSource, gl.VERTEX_SHADER);
240 
241                 // And then compile the fragment shader too.
242                 var fragmentShader  = compileShader(gl, fragmentShaderSource, gl.FRAGMENT_SHADER);
243 
244                 // As you might expect, we are going to run some code, so we need a program.
245                 var program         = createProgram(gl, vertexShader, fragmentShader);
246 
247                 // Make this the currently active program
248                 gl.useProgram(program);
249 
250                 // This is a handle to what will be a buffer
251                 vertexBuffer    = createBuffer(vertices);
252 
253                 // Repeat the same process again, create another buffer with different vertices and draw them.
254                 anotherBuffer   = createBuffer(moreVertices);
255 
256                 var animationMatrix = generateModelViewMatrix(0.0);
257 
258                 drawFrame(gl, identityMatrix, animationMatrix, vertexBuffer, anotherBuffer);

Notes