Real-Time Draw to Background Buffer
in
Programming Questions
•
1 year ago
I'm trying to put some animation into a background buffer rather than displaying it to the main window (so that I can grab portions of it at arbitrary moments). What I'm doing, at the moment, is displaying colored lines that drift across the screen, using a class I've created for the purpose. I want those lines to go into the background buffer, not the main window.
I've created a PImage called buf. I then do this:
void draw() {
buf.loadPixels();
myLine1.animate();
myLine2.animate();
myLine3.animate();
buf.updatePixels();
}
... but the lines are still showing up in the main window. I don't yet know whether they're even in the buffer; haven't tested that. The question is how to redirect draw() to write data strictly to the buffer.
The only drawing function in the line-drawing class is line(). Here's the method I'm calling in my class:
void show () {
stroke(r, g, b, 65);
strokeWeight(3);
line(x1, y1, z1, x2, y2, z2);
}
I'm sure there's a simple way to do what I want -- I just haven't been able to find it by searching through the reference and tutorials. Suggestions would be much appreciated! Thanks.
--Jim Aikin
1