diff --git a/src/renderer/webgl/renderNodes/Camera.js b/src/renderer/webgl/renderNodes/Camera.js index 288bf5a74..35c1b2403 100644 --- a/src/renderer/webgl/renderNodes/Camera.js +++ b/src/renderer/webgl/renderNodes/Camera.js @@ -37,20 +37,24 @@ var Camera = new Class({ */ run: function (drawingContext, children, camera, parentTransformMatrix) { - // Generate a drawing context. - // TODO: Handle FX stacks and framebuffer changeover. - var currentContext = drawingContext.getClone(); - currentContext.autoClear = 0; - - // Set camera scissor. - var cx = camera.x; - var cy = camera.y; - var cw = camera.width; - var ch = camera.height; - currentContext.setScissorBox(cx, cy, cw, ch); - - // Enter drawing context. - currentContext.use(); + var currentContext = drawingContext; + if (camera._customViewport) + { + // Generate a drawing context. + // TODO: Handle FX stacks and framebuffer changeover. + currentContext = drawingContext.getClone(); + currentContext.autoClear = 0; + + // Set camera scissor. + var cx = camera.x; + var cy = camera.y; + var cw = camera.width; + var ch = camera.height; + currentContext.setScissorBox(cx, cy, cw, ch); + + // Enter drawing context. + currentContext.use(); + } // Draw camera fill. if (camera.backgroundColor.alphaGL > 0) @@ -73,7 +77,10 @@ var Camera = new Class({ // Finish rendering. - currentContext.release(); + if (camera._customViewport) + { + currentContext.release(); + } camera.dirty = false;