Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed texture filtering bug in p5.Framebuffer #6420

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/webgl/p5.Framebuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,8 @@ class Framebuffer {
this.target._renderer,
this.color,
{
glMinFilter: filter,
glMagFilter: filter
minFilter: filter,
magFilter: filter
}
);
this.target._renderer.textures.set(this.color, this.colorP5Texture);
Expand Down
30 changes: 30 additions & 0 deletions test/unit/webgl/p5.Framebuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,4 +541,34 @@ suite('p5.Framebuffer', function() {
});
}
});

suite('texture filtering', function() {
test('can create a framebuffer that uses NEAREST texture filtering',
function() {
myp5.createCanvas(10, 10, myp5.WEBGL);
const fbo = myp5.createFramebuffer({
textureFiltering: myp5.NEAREST
});

assert.equal(
fbo.color.framebuffer.colorP5Texture.glMinFilter, fbo.gl.NEAREST
);
assert.equal(
fbo.color.framebuffer.colorP5Texture.glMagFilter, fbo.gl.NEAREST
);
});
test('can create a framebuffer that uses LINEAR texture filtering',
function() {
myp5.createCanvas(10, 10, myp5.WEBGL);
// LINEAR should be the default
const fbo = myp5.createFramebuffer({});

assert.equal(
fbo.color.framebuffer.colorP5Texture.glMinFilter, fbo.gl.LINEAR
);
assert.equal(
fbo.color.framebuffer.colorP5Texture.glMagFilter, fbo.gl.LINEAR
);
});
});
});