title: Switch canvas context
body: <p>Assuming that I have a WebGL canvas (by calling <code>getContext(&quot;experimental-webgl&quot;)</code>).</p>
  <p>Is there any way to switch context later for using a <code>&quot;2d&quot;</code> one ?</p>
  <p>The goal of such thing would be to display a debug BSOD-like when an error happening during rendering.</p>
  <p>If it's not possible, then :</p>
  <ul>
  <li>Can I embed an html element over a canvas, and force this element to have exactly the same same that the canvas (even if this last is resized) ?</li>
  <li>Can I replace an dom node, and update every reference about the old one to reflect the changement ?</li>
  </ul>
  <p><strong>[edit]</strong> This is my current minimal call code. Canvas is a DOM node containing a canvas which is filled by WebGL API, and callback is a function which process a single frame.</p>
  <pre><code>function failure(cvs, e) {
      var ctx = cvs.getContext('2d'); // Fail here, returns `null' if cvs.getContext('webgl') has been called
      ctx.fillStyle = 'rgb(0, 0, 0)';
      ctx.fillRect(0, 0, cvs.width, cvs.height);
      ctx.fillStyle = 'rgb(255, 255, 255)';
      ctx.font = 'bold 12px sans-serif';
      ctx.fillText(e.toString(), 0, 0);
  }
  
  function foobar(canvas, callback) {
      try {
          callback();
      } catch (e) {
          failure(canvas, e);
          throw e;
      } finally {
          requestAnimationFrame(arguments.callee);
      }
  }
  </code></pre>