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

beginClip() is accidentally being applied to framebuffers #6989

Closed
1 task done
davepagurek opened this issue Apr 22, 2024 · 0 comments · Fixed by #6990
Closed
1 task done

beginClip() is accidentally being applied to framebuffers #6989

davepagurek opened this issue Apr 22, 2024 · 0 comments · Fixed by #6990
Assignees

Comments

@davepagurek
Copy link
Contributor

davepagurek commented Apr 22, 2024

Most appropriate sub-area of p5.js?

  • WebGL

p5.js version

1.9.1

Web browser and version

Chrome 124 (not Firefox, weirdly!)

Operating system

MacOS 14.2.1

Steps to reproduce this

Steps:

  1. Start clipping to a shape
  2. Draw something to a framebuffer. The clip shouldn't be applied to the framebuffer's context.
  3. Stop clipping
  4. Draw the framebuffer to the main canvas
  5. The framebuffer should appear unclipped, since its framebuffer context was never clipped, and clipping was not applied when drawing it to the main canvas.

Snippet:

let fbo

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

function draw() {
  background(220);
  push()
  beginClip()
  circle(0, 0, 200)
  endClip()
    
  fbo.draw(() => {
    console.log(drawingContext.isEnabled(drawingContext.STENCIL_TEST))
    fill('red')
    noStroke()
    plane(width, height)
  })
  pop()
  
  imageMode(CENTER)
  image(fbo, 0, 0)
  
  noLoop()
}

The expected output is a full red canvas, but instead we get an empty canvas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant