We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Layers - keeping things seperate
Page Index Toggle Pages: 1
Layers - keeping things seperate (Read 463 times)
Layers - keeping things seperate
Jul 28th, 2008, 12:53am
 
I've made a drawing app, and the drawing field is sampled for brightness and the values outputted.  This happens from left to right, and I've made a playback wiper to scroll across the screen.

The problem is, the playback wiper interferes with things like get(), drawing functions, etc., as it's being drawn as part of the image that's being sampled and altered.

Is there a way to put the wiper on a different 'layer' so that it won't be interfering with the drawing or filtering?  Is moving to OpenGL the answer?
Re: Layers - keeping things seperate
Reply #1 - Jul 28th, 2008, 2:37am
 
You could just copy the pixels to a buffer before you draw the "wiper" and then copy them back at the beginning of the next frame:


Code:

//in your draw loop:

loadPixels();
for (int i=0; i<width*height; i++) {
     pixels[i] = pixelBuffer[i];  
}
updatePixels();


//Do your drawing stuff

loadPixels();
for (int i=0; i<width*height; i++) {
     pixelBuffer[i] = pixels[i];  
}
updatePixels();

//Draw your wiper



Re: Layers - keeping things seperate
Reply #2 - Jul 28th, 2008, 6:09pm
 
Brilliant, thanks.  I had a similar system going, but it wasn't nearly as elegant as this (plus it didn't work).
Page Index Toggle Pages: 1