function initWebGL(canvas) 
{

    let gl = null;
    const msg = "Your browser does not support WebGL, or it is not enabled by default.";

    try {
        // The getContext method can take one of the following context id strings:
        // "2d" for a 2d canvas context, or "webgl2" for a WebGL context.
        gl = canvas.getContext("webgl2");
    } 
    catch (e){
        msg = "Error creating WebGL Context!: " + e.toString();
    }

    if (!gl){
        throw new Error(msg);
    }

    return gl;        
}
// Initializes the context for use with WebGL
Initializes the context for use with WebGL
Initializes the context for use with WebGL
function initWebGL(canvas) 
{
    let gl = null;
    const msg = "Your browser does not support WebGL, or it is not enabled by default.";
    try {
        gl = canvas.getContext("webgl2");
    } 
    catch (e){
        msg = "Error creating WebGL Context!: " + e.toString();
    }
    if (!gl){
        throw new Error(msg);
    }
    return gl;        
}
function initWebGL ( canvas ) { let gl = null ; const msg = "Your browser does not support WebGL, or it is not enabled by default." ; try { gl = canvas . getContext ( "webgl2" ) ; } catch ( e ) { msg = "Error creating WebGL Context!: " + e . toString ( ) ; } if ( ! gl ) { throw new Error ( msg ) ; } return gl ; }
Initializes the context for use with WebGL
Initializes the context for use with WebGL
// The getContext method can take one of the following context id strings: // "2d" for a 2d canvas context, or "webgl2" for a WebGL context.