setupWebGL = function(canvas, opt_attribs, opt_onError) {
  function handleCreationError(msg) {
    var container = canvas.parentNode;
    if (container) {
      var str = window.WebGLRenderingContext ?
           OTHER_PROBLEM :
           GET_A_WEBGL_BROWSER;
      if (msg) {
        str += "<br/><br/>Status: " + msg;
      }
      container.innerHTML = makeFailHTML(str);
    }
  };

  opt_onError = opt_onError || handleCreationError;

  if (canvas.addEventListener) {
    canvas.addEventListener("webglcontextcreationerror", function(event) {
          opt_onError(event.statusMessage);
        }, false);
  }
  var context = create3DContext(canvas, opt_attribs);
  if (!context) {
    if (!window.WebGLRenderingContext) {
      opt_onError("");
    }
  }
  return context;
}
Creates a webgl context. If creation fails it will
change the contents of the container of the <canvas>
tag to an error message with the correct links for WebGL.
@param {Element} canvas. The canvas element to create a
    context from.
@param {WebGLContextCreationAttirbutes} opt_attribs Any
    creation attributes you want to pass in.
@param {function:(msg)} opt_onError An function to call
    if there is an error during creation.
@return {WebGLRenderingContext} The created context.