function createTriangle(gl) 
{
    let vertexBuffer;
    vertexBuffer = gl.createBuffer();
    
    gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);

    let verts = [
        0.0,  0.5, 0.0,
        -.5, -.5,  0.0,
        .5, -.5, 0.0,
    ];

    // void gl.bufferData(target, ArrayBufferView srcData, usage, srcOffset, length);
    // target = gl.ARRAY_BUFFER: Buffer containing vertex attributes, such as vertex coordinates, texture coordinate data, or vertex color data.
    // srcData = This is a new data type introduced into web browsers for use with WebGL. Float32Array is a type of ArrayBuffer, also known as a typed array. This is a JavaScript type that stores compact binary data. 
    // usage = A GLenum specifying the usage pattern of the data store. gl.STATIC_DRAW: Contents of the buffer are likely to be used often and not change often. Contents are written to the buffer, but not read.
    gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(verts), gl.STATIC_DRAW);

    // The resulting object contains the vertexbuffer, the size of the vertex structure (3 floats, x, y, z), the number of vertices to be drawn, the the primitive to draw.
    let triangle = {buffer:vertexBuffer, vertSize: 3, nVerts: 3, primtype:gl.TRIANGLE_STRIP};
    
    return triangle;
}
// Primitives use arrays of data, called buffers, which define the positions of the vertices to be drawn.
Primitives use arrays of data, called buffers, which define the positions of the vertices to be drawn.
Primitives use arrays of data called buffers which define the positions of the vertices to be drawn .
function createTriangle(gl) 
{
    let vertexBuffer;
    vertexBuffer = gl.createBuffer();
    gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
    let verts = [
        0.0,  0.5, 0.0,
        -.5, -.5,  0.0,
        .5, -.5, 0.0,
    ];
    gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(verts), gl.STATIC_DRAW);
    let triangle = {buffer:vertexBuffer, vertSize: 3, nVerts: 3, primtype:gl.TRIANGLE_STRIP};
    return triangle;
}
function createTriangle ( gl ) { let vertexBuffer ; vertexBuffer = gl . createBuffer ( ) ; gl . bindBuffer ( gl . ARRAY_BUFFER , vertexBuffer ) ; let verts = [ 0.0 , 0.5 , 0.0 , - .5 , - .5 , 0.0 , .5 , - .5 , 0.0 , ] ; gl . bufferData ( gl . ARRAY_BUFFER , new Float32Array ( verts ) , gl . STATIC_DRAW ) ; let triangle = { buffer : vertexBuffer , vertSize : 3 , nVerts : 3 , primtype : gl . TRIANGLE_STRIP } ; return triangle ; }
Primitives use arrays of data, called buffers, which define the positions of the vertices to be drawn.
Primitives use arrays of data called buffers which define the positions of the vertices to be drawn .
// void gl.bufferData(target, ArrayBufferView srcData, usage, srcOffset, length); // target = gl.ARRAY_BUFFER: Buffer containing vertex attributes, such as vertex coordinates, texture coordinate data, or vertex color data. // srcData = This is a new data type introduced into web browsers for use with WebGL. Float32Array is a type of ArrayBuffer, also known as a typed array. This is a JavaScript type that stores compact binary data.  // usage = A GLenum specifying the usage pattern of the data store. gl.STATIC_DRAW: Contents of the buffer are likely to be used often and not change often. Contents are written to the buffer, but not read. // The resulting object contains the vertexbuffer, the size of the vertex structure (3 floats, x, y, z), the number of vertices to be drawn, the the primitive to draw.