diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index dbb401f..8c0e68f 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -108,7 +108,7 @@ * @member {WebGLRenderingContext} */ // initialize the context so it is ready for the managers. - this.gl = createContext(this.view, this._contextOptions); + this.gl = options.context || createContext(this.view, this._contextOptions); this.CONTEXT_UID = CONTEXT_UID++; @@ -239,7 +239,7 @@ // apply transform.. - this.currentRenderer.flush(); + this.setObjectRenderer(this.emptyRenderer); this.emit('postrender'); }; @@ -279,6 +279,8 @@ */ WebGLRenderer.prototype.resize = function (width, height) { + if(width * this.resolution === this.width && height * this.resolution === this.height)return; + SystemRenderer.prototype.resize.call(this, width, height); this.rootRenderTarget.resize(width, height); diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index dbb401f..8c0e68f 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -108,7 +108,7 @@ * @member {WebGLRenderingContext} */ // initialize the context so it is ready for the managers. - this.gl = createContext(this.view, this._contextOptions); + this.gl = options.context || createContext(this.view, this._contextOptions); this.CONTEXT_UID = CONTEXT_UID++; @@ -239,7 +239,7 @@ // apply transform.. - this.currentRenderer.flush(); + this.setObjectRenderer(this.emptyRenderer); this.emit('postrender'); }; @@ -279,6 +279,8 @@ */ WebGLRenderer.prototype.resize = function (width, height) { + if(width * this.resolution === this.width && height * this.resolution === this.height)return; + SystemRenderer.prototype.resize.call(this, width, height); this.rootRenderTarget.resize(width, height); diff --git a/src/core/textures/BaseRenderTexture.js b/src/core/textures/BaseRenderTexture.js index c690dc4..db8d2d8 100644 --- a/src/core/textures/BaseRenderTexture.js +++ b/src/core/textures/BaseRenderTexture.js @@ -47,11 +47,6 @@ */ function BaseRenderTexture(width, height, scaleMode, resolution) { - if (!renderer) - { - throw new Error('Unable to create BaseRenderTexture, you must pass a renderer into the constructor.'); - } - BaseTexture.call(this, null, scaleMode); this.width = width || 100; diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index dbb401f..8c0e68f 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -108,7 +108,7 @@ * @member {WebGLRenderingContext} */ // initialize the context so it is ready for the managers. - this.gl = createContext(this.view, this._contextOptions); + this.gl = options.context || createContext(this.view, this._contextOptions); this.CONTEXT_UID = CONTEXT_UID++; @@ -239,7 +239,7 @@ // apply transform.. - this.currentRenderer.flush(); + this.setObjectRenderer(this.emptyRenderer); this.emit('postrender'); }; @@ -279,6 +279,8 @@ */ WebGLRenderer.prototype.resize = function (width, height) { + if(width * this.resolution === this.width && height * this.resolution === this.height)return; + SystemRenderer.prototype.resize.call(this, width, height); this.rootRenderTarget.resize(width, height); diff --git a/src/core/textures/BaseRenderTexture.js b/src/core/textures/BaseRenderTexture.js index c690dc4..db8d2d8 100644 --- a/src/core/textures/BaseRenderTexture.js +++ b/src/core/textures/BaseRenderTexture.js @@ -47,11 +47,6 @@ */ function BaseRenderTexture(width, height, scaleMode, resolution) { - if (!renderer) - { - throw new Error('Unable to create BaseRenderTexture, you must pass a renderer into the constructor.'); - } - BaseTexture.call(this, null, scaleMode); this.width = width || 100; diff --git a/src/core/textures/RenderTexture.js b/src/core/textures/RenderTexture.js index 9ea0c33..c5551c4 100644 --- a/src/core/textures/RenderTexture.js +++ b/src/core/textures/RenderTexture.js @@ -45,10 +45,6 @@ */ function RenderTexture(baseRenderTexture, frame) { - if (!renderer) - { - throw new Error('Unable to create RenderTexture, you must pass a renderer into the constructor.'); - } /** * The base texture object that this texture uses