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

Support nesting draw calls #9

Closed
davepagurek opened this issue Mar 25, 2022 · 0 comments · Fixed by #11
Closed

Support nesting draw calls #9

davepagurek opened this issue Mar 25, 2022 · 0 comments · Fixed by #11
Labels
bug Something isn't working

Comments

@davepagurek
Copy link
Owner

Right now I think this breaks:

fbo1.draw(() => {
  fbo2.draw(() => {
    // etc
  })
  texture(fbo2.color)
  rect(0, 0, width, height)
})

This is because the draw call binds the main canvas when it finishes: https://github.com/davepagurek/p5.Framebuffer/blob/main/p5.Framebuffer.js#L206

To fix this, it would need to record whatever context is currently bound before it starts, and then re-bind that at the end again instead of binding null (the main canvas.)

As a temporary workaround, this should be fine:

fbo2.draw(() => {
  // etc
})
fbo1.draw(() => {
  texture(fbo2.color)
  rect(0, 0, width, height)
})
@davepagurek davepagurek added the bug Something isn't working label Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant