Skip to content

Commit

Permalink
feat: add WebGLRenderer.contextOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
06wj committed Jan 9, 2019
1 parent 83d87d6 commit 8d6f428
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/renderer/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
}
}
return this._isSupported;
}
},
/**
* WebGL context Options
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getContextAttributes
* @type {Object}
*/
contextOptions: null
},
renderType:'webgl',
gl:null,
Expand All @@ -89,7 +95,8 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
constructor: function(properties){
WebGLRenderer.superclass.constructor.call(this, properties);
var that = this;
this.gl = this.canvas.getContext("webgl")||this.canvas.getContext('experimental-webgl');
var contextOptions = WebGLRenderer.contextOptions || {};
this.gl = this.canvas.getContext("webgl", contextOptions)||this.canvas.getContext('experimental-webgl', contextOptions);

this.maxBatchNum = WebGLRenderer.MAX_BATCH_NUM;
this.positionStride = WebGLRenderer.ATTRIBUTE_NUM * 4;
Expand Down

0 comments on commit 8d6f428

Please sign in to comment.