Skip to content

Commit 7fd3c4f

Browse files
committed
Fix updatePixels incorrect on WebGL mode
1 parent d85876c commit 7fd3c4f

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/webgl/p5.Framebuffer.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -1556,11 +1556,20 @@ class Framebuffer {
15561556
this.begin();
15571557
this.renderer.push();
15581558
// this.renderer.imageMode(constants.CENTER);
1559-
this.renderer.states.imageMode = constants.CENTER;
1559+
this.renderer.states.imageMode = constants.CORNER;
1560+
this.renderer.setCamera(this.filterCamera);
15601561
this.renderer.resetMatrix();
15611562
this.renderer.states.doStroke = false;
15621563
this.renderer.clear();
1563-
this.renderer.image(this, 0, 0);
1564+
this.renderer._drawingFilter = true;
1565+
this.renderer.image(
1566+
this,
1567+
0, 0,
1568+
this.width, this.height,
1569+
-this.renderer.width / 2, -this.renderer.height / 2,
1570+
this.renderer.width, this.renderer.height
1571+
);
1572+
this.renderer._drawingFilter = false;
15641573
this.renderer.pop();
15651574
if (this.useDepth) {
15661575
gl.clearDepth(1);

src/webgl/p5.RendererGL.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1127,8 +1127,8 @@ class RendererGL extends Renderer {
11271127
this.push();
11281128
this.resetMatrix();
11291129
this.clear();
1130-
this.states.imageMode = constants.CENTER;
1131-
this.image(fbo, 0, 0, fbo.width, fbo.height, 0, 0, fbo.width, fbo.height);
1130+
this.states.imageMode = constants.CORNER;
1131+
this.image(fbo, 0, 0, fbo.width, fbo.height, -fbo.width/2, -fbo.height/2, fbo.width, fbo.height);
11321132
this.pop();
11331133
this.GL.clearDepth(1);
11341134
this.GL.clear(this.GL.DEPTH_BUFFER_BIT);

0 commit comments

Comments
 (0)