02-drawingandshaders/scripts/demo02-02.js
/**
 * Display function, sets up various matrices, binds data to the GPU,
 * and displays it.
 */
Display function, sets up various matrices, binds data to the GPU,
and displays it.
Display function sets up various matrices binds data to the GPU and displays it .
function draw() {
    gl.clear( gl.COLOR_BUFFER_BIT );
    gl.useProgram(gl_program);
    gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
    gl.enableVertexAttribArray(gl_program_loc.aPosition);
    gl.enableVertexAttribArray(gl_program_loc.aColor);
    gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indices);
    gl.vertexAttribPointer(gl_program_loc.aPosition, 3, gl.FLOAT, false, 12,  0);
    gl.vertexAttribPointer(gl_program_loc.aColor,    4, gl.FLOAT, false, 16, 36);
    gl.drawElements(gl.TRIANGLES, 3, gl.UNSIGNED_SHORT, 0);
}
function draw ( ) { gl . clear ( gl . COLOR_BUFFER_BIT ) ; gl . useProgram ( gl_program ) ; gl . bindBuffer ( gl . ARRAY_BUFFER , vbo ) ; gl . enableVertexAttribArray ( gl_program_loc . aPosition ) ; gl . enableVertexAttribArray ( gl_program_loc . aColor ) ; gl . bindBuffer ( gl . ELEMENT_ARRAY_BUFFER , indices ) ; gl . vertexAttribPointer ( gl_program_loc . aPosition , 3 , gl . FLOAT , false , 12 , 0 ) ; gl . vertexAttribPointer ( gl_program_loc . aColor , 4 , gl . FLOAT , false , 16 , 36 ) ; gl . drawElements ( gl . TRIANGLES , 3 , gl . UNSIGNED_SHORT , 0 ) ; }
Display function, sets up various matrices, binds data to the GPU,
 and displays it.
Display function sets up various matrices binds data to the GPU and displays it .
// Clear the color buffer // Use the created shader program // Bind vbo to be the current array buffer // Enables a vertex attribute array for vertex positions and colors // Setup the pointer to the position data