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 noErase() breaking in WebGL #7443

Merged
merged 2 commits into from
Dec 21, 2024
Merged

Fix noErase() breaking in WebGL #7443

merged 2 commits into from
Dec 21, 2024

Conversation

davepagurek
Copy link
Contributor

@davepagurek davepagurek commented Dec 21, 2024

Resolves #7442

Changes:

  • _cachedBlendMode should represent the blend mode currently applied, whatever it is.
  • _preEraseBlendMode, meanwhile, keeps track of what to return to after noErase(), so it's ok to update _cachedBlendMode

Screenshots of the change

let b;
function setup() {
  createCanvas(400, 400, WEBGL);
  b = createFramebuffer();
}

function draw() {
  background(0);
  
  b.begin()
  {
    fill('red')
    noStroke()
    rect(-100,-100,200,200)

    erase()       // This is Erasing the Main Canvas, rather than the framebuffer
    circle(0,0,100)
    noErase()
  }
  b.end()
  
  image(b,-200,-200)
}

Before:
image

After:
image

PR Checklist

@davepagurek davepagurek merged commit 05e35cb into dev-2.0 Dec 21, 2024
2 checks passed
@davepagurek davepagurek deleted the fix/erase-fbo branch December 21, 2024 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant