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

q5-webgpu: saveCanvas, get, and copy #92

Open
quinton-ashley opened this issue Dec 11, 2024 · 0 comments
Open

q5-webgpu: saveCanvas, get, and copy #92

quinton-ashley opened this issue Dec 11, 2024 · 0 comments

Comments

@quinton-ashley
Copy link
Collaborator

In WebGPU the canvas is cleared at the start of each draw pass. There's no built-in way to keep the previous frame and draw a new frame.

I'm thinking of keeping this default behavior, since q5 is geared more towards interactive art anyway.

I'd like to somehow give users the option to draw onto the previous canvas frame, yet currently saveCanvas, get, and `copy aren't implemented in q5 webgpu.

Here's my idea for how to enable continuous drawing to the canvas.

let prevFrame;

function draw() {
  background(prevFrame);
  
  rect(random(width), random(height), 10, 10);
  
  prevFrame = copy();
}
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

No branches or pull requests

1 participant