namespace NT { /**
     * The WebGL rendering context.
     * */ export var gl ; /**
     * Responsible for setting up a WebGL rendering context.
     * */ export class GLUtilities { param elementId public static Initialize ( elementId ? ) { let canvas ; if ( elementId !== undefined ) { canvas = document . getElementById ( elementId ) as HTMLCanvasElement ; if ( canvas === null ) { throw new Error ( "Cannot find a canvas element named:" + elementId ) ; } } else { canvas = document . createElement ( "canvas" ) as HTMLCanvasElement ; document . body . appendChild ( canvas ) ; } gl = canvas . getContext ( "webgl" ) ; if ( gl === undefined || gl === null ) { gl = canvas . getContext ( "experimental-webgl" ) ; if ( gl === undefined || gl === null ) { throw new Error ( "Unable to initialize WebGL!" ) ; } } return canvas ; } } }