Skip to content

Commit 5500364

Browse files
committed
Clamp scissor
1 parent b317dc3 commit 5500364

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

src/renderer/webgl/WebGLRenderer.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,11 @@ var WebGLRenderer = new Class({
849849
this.flush();
850850

851851
// https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/scissor
852-
gl.scissor(x, (this.drawingBufferHeight - y - h), w, h);
852+
853+
if (w > 0 && h > 0)
854+
{
855+
gl.scissor(x, (this.drawingBufferHeight - y - h), w, h);
856+
}
853857
}
854858
},
855859

@@ -1536,6 +1540,8 @@ var WebGLRenderer = new Class({
15361540

15371541
if (camera.renderToTexture)
15381542
{
1543+
this.flush();
1544+
15391545
this.pushScissor(cx, cy, cw, -ch);
15401546

15411547
this.setFramebuffer(camera.framebuffer);
@@ -1595,6 +1601,7 @@ var WebGLRenderer = new Class({
15951601

15961602
if (camera.renderToTexture)
15971603
{
1604+
// this.flush();
15981605
TextureTintPipeline.flush();
15991606

16001607
this.setFramebuffer(null);
@@ -1603,9 +1610,9 @@ var WebGLRenderer = new Class({
16031610

16041611
var getTint = Utils.getTintAppendFloatAlpha;
16051612

1606-
var p = (camera.pipeline) ? camera.pipeline : TextureTintPipeline;
1607-
1608-
p.batchTexture(
1613+
var pipeline = (camera.pipeline) ? camera.pipeline : TextureTintPipeline;
1614+
1615+
pipeline.batchTexture(
16091616
camera,
16101617
camera.glTexture,
16111618
camera.width, camera.height,
@@ -1627,6 +1634,8 @@ var WebGLRenderer = new Class({
16271634
null
16281635
);
16291636

1637+
// this.setPipeline(TextureTintPipeline);
1638+
16301639
// Force clear the current texture so that items next in the batch (like Graphics) don't try and use it
16311640
this.setBlankTexture(true);
16321641
}

0 commit comments

Comments
 (0)