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

Fix clear() on framebuffers on Intel macs #6429

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/webgl/p5.RendererGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,22 @@ p5.RendererGL = class RendererGL extends p5.Renderer {
const _r = args[0] || 0;
const _g = args[1] || 0;
const _b = args[2] || 0;
const _a = args[3] || 0;
let _a = args[3] || 0;

const activeFramebuffer = this.activeFramebuffer();
if (
activeFramebuffer &&
activeFramebuffer.format === constants.UNSIGNED_BYTE &&
!activeFramebuffer.antialias &&
_a === 0
) {
// Drivers on Intel Macs check for 0,0,0,0 exactly when drawing to a
// framebuffer and ignore the command if it's the only drawing command to
// the framebuffer. To work around it, we can set the alpha to a value so
// low that it still rounds down to 0, but that circumvents the buggy
// check in the driver.
_a = 1e-10;
}

this.GL.clearColor(_r * _a, _g * _a, _b * _a, _a);
this.GL.clearDepth(1);
Expand Down
Loading