Skip to content

Commit 62ff014

Browse files
authored
Merge pull request #8193 from processing/fix/filter-size
Fix filters on framebuffers of a different size than the canvas
2 parents f8e1c32 + 597bc46 commit 62ff014

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

src/webgl/p5.RendererGL.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,8 +1352,8 @@ class RendererGL extends Renderer {
13521352
fbo,
13531353
0,
13541354
0,
1355-
this.width,
1356-
this.height,
1355+
fbo.width,
1356+
fbo.height,
13571357
-target.width / 2,
13581358
-target.height / 2,
13591359
target.width,

test/unit/visual/cases/webgl.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ visualSuite('WebGL', function() {
5151
screenshot();
5252
});
5353

54+
visualTest('On a framebuffer of a different size from the canvas', function(p5, screenshot) {
55+
p5.createCanvas(50, 50, p5.WEBGL);
56+
const fbo = p5.createFramebuffer({ antialias: true, width: 25, height: 100 });
57+
fbo.begin();
58+
p5.background('blue');
59+
p5.fill('red');
60+
p5.circle(0, 0, 20);
61+
p5.filter(p5.BLUR, 3);
62+
fbo.end();
63+
p5.imageMode(p5.CENTER);
64+
p5.image(fbo, 0, 0);
65+
screenshot();
66+
});
67+
5468
visualTest(
5569
'On a framebuffer sized differently from the main canvas',
5670
function(p5, screenshot) {
1.98 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"numScreenshots": 1
3+
}

0 commit comments

Comments
 (0)