code: function WebGlStage(opts) {
    opts = opts || {};
  
    var self = this;
  
    this.constructor.super_.call(this, opts);
  
    this._generateMipmaps = opts.generateMipmaps != null ?
      opts.generateMipmaps : false;
  
    this._loader = new HtmlImageLoader(this);
  
    this._domElement = document.createElement('canvas');
  
    setAbsolute(this._domElement);
    setFullSize(this._domElement);
  
    this._gl = initWebGlContext(this._domElement, opts);
  
    this._handleContextLoss = function() {
      self.emit('webglcontextlost');
      self._gl = null;
    };
  
    // Handle WebGl context loss.
    this._domElement.addEventListener('webglcontextlost', this._handleContextLoss);
  
    // WebGl renderers are singletons for a given stage. This list stores the
    // existing renderers so they can be reused across layers with the same
    // geometry and view type.
    this._rendererInstances = [];
  }
docs: @class WebGlStage
  @extends Stage
  @classdesc
  
  A {@link Stage} implementation using WebGl.
  
  @param {Object} opts
  @param {boolean} [opts.antialias=false]
  @param {boolean} [opts.preserveDrawingBuffer=false]
  @param {boolean} [opts.generateMipmaps=false]
  
  The `antialias` and `preserveDrawingBuffer` options control the WebGL
  context attributes of the same name. The `alpha` and `premultipliedAlpha`
  WebGL context attributes are set to their default true value and cannot
  be overriden; this allows semitransparent textures to be composited with
  the page. See:
  https://www.khronos.org/registry/webgl/specs/1.0/#WEBGLCONTEXTATTRIBUTES
  
  The `generateMipmaps` option controls texture mipmap generation. Mipmaps
  may improve rendering quality, at the cost of increased memory usage.
  Due to technical limitations, they are only generated for textures whose
  dimensions are a power of two. See:
  https://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences#Non-Power_of_Two_Texture_Support
  
  Also see the available {@link Stage} options.