diff --git a/src/renderer/webgl/base/rendertarget.js b/src/renderer/webgl/base/rendertarget.js index b2605c88..499666da 100644 --- a/src/renderer/webgl/base/rendertarget.js +++ b/src/renderer/webgl/base/rendertarget.js @@ -70,16 +70,13 @@ XML3D.extend(GLRenderTarget.prototype, { }, getScale: function () { return this.scale; }, bind: function () { - var created = false; if (!this.handle) { this.createFrameBuffer(this.opt.colorFormat, this.opt.depthFormat, this.opt.stencilFormat); - created = true; } if (this.valid) { var gl = this.context.gl; gl.bindFramebuffer(gl.FRAMEBUFFER, this.handle); - // Set default viewport - created && gl.viewport(0, 0, this.width, this.height); + gl.viewport(0, 0, this.width, this.height); } }, unbind: function () { var gl = this.context.gl; @@ -306,16 +303,13 @@ XML3D.extend(GLScaledRenderTarget.prototype, { return this.scale; }, bind: function (side) { - var created = false; if (this.framebuffers.length <= 0) { this.createFrameBuffers(this.opt.colorFormat, this.opt.depthFormat, this.opt.stencilFormat); - created = true; } if (this.valid) { var gl = this.context.gl; gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffers[side]); - // Set default viewport - created && gl.viewport(0, 0, this.width, this.height); + gl.viewport(0, 0, this.width, this.height); } }, unbind: function () { diff --git a/src/renderer/webgl/render-passes/forward.js b/src/renderer/webgl/render-passes/forward.js index 4a406a5f..5898f076 100644 --- a/src/renderer/webgl/render-passes/forward.js +++ b/src/renderer/webgl/render-passes/forward.js @@ -29,7 +29,6 @@ XML3D.extend(ForwardRenderPass.prototype, { target.bind(); this.setGLStates(); - gl.viewport(0, 0, width, height); scene.updateReadyObjectsFromActiveView(aspect); scene.getActiveView().getWorldToViewMatrix(c_worldToViewMatrix); diff --git a/src/renderer/webgl/render-passes/light-pass.js b/src/renderer/webgl/render-passes/light-pass.js index 69887ce6..2dde703d 100644 --- a/src/renderer/webgl/render-passes/light-pass.js +++ b/src/renderer/webgl/render-passes/light-pass.js @@ -36,7 +36,6 @@ XML3D.createClass(LightPass, SceneRenderPass, { target.bind(); gl.clear(gl.DEPTH_BUFFER_BIT | gl.COLOR_BUFFER_BIT); - gl.viewport(0, 0, width, height); gl.enable(gl.DEPTH_TEST); var count = {objects: 0, primitives: 0}; diff --git a/src/renderer/webgl/render-passes/pick-object.js b/src/renderer/webgl/render-passes/pick-object.js index a79a61d0..713b2f6f 100644 --- a/src/renderer/webgl/render-passes/pick-object.js +++ b/src/renderer/webgl/render-passes/pick-object.js @@ -20,7 +20,6 @@ XML3D.extend(PickObjectRenderPass.prototype, { gl.enable(gl.DEPTH_TEST); gl.disable(gl.CULL_FACE); gl.disable(gl.BLEND); - gl.viewport(0, 0, target.getWidth(), target.getHeight()); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); var program = this.renderInterface.context.programFactory.getPickingObjectIdProgram(); diff --git a/src/renderer/webgl/render-passes/pointlight-pass.js b/src/renderer/webgl/render-passes/pointlight-pass.js index 53502dd2..cca657be 100644 --- a/src/renderer/webgl/render-passes/pointlight-pass.js +++ b/src/renderer/webgl/render-passes/pointlight-pass.js @@ -109,7 +109,6 @@ XML3D.createClass(PointLightPass, SceneRenderPass, { target.bind(side); gl.clear(gl.DEPTH_BUFFER_BIT | gl.COLOR_BUFFER_BIT); - gl.viewport(0, 0, width, height); gl.enable(gl.DEPTH_TEST); var count = {objects: 0, primitives: 0}; diff --git a/src/renderer/webgl/render-passes/ssao-pass.js b/src/renderer/webgl/render-passes/ssao-pass.js index da9ea34d..4134fe03 100644 --- a/src/renderer/webgl/render-passes/ssao-pass.js +++ b/src/renderer/webgl/render-passes/ssao-pass.js @@ -86,7 +86,6 @@ XML3D.extend(SSAOPass.prototype, { target.bind(); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); - gl.viewport(0, 0, target.getWidth(), target.getHeight()); gl.disable(gl.DEPTH_TEST); this._program.bind(); diff --git a/src/renderer/webgl/render-passes/vertexattribute-pass.js b/src/renderer/webgl/render-passes/vertexattribute-pass.js index 089d8734..da18156f 100644 --- a/src/renderer/webgl/render-passes/vertexattribute-pass.js +++ b/src/renderer/webgl/render-passes/vertexattribute-pass.js @@ -17,7 +17,6 @@ XML3D.extend(VertexAttributePass.prototype, { target.bind(); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); - gl.viewport(0, 0, target.getWidth(), target.getHeight()); gl.enable(gl.DEPTH_TEST); scene.updateReadyObjectsFromActiveView(aspect);