First off, thank you for Processing !!
A great program, and support. All hail open source!
That said I have read every tutorial, picked a few custom libraries and now have an expansive library of examples I conjured created since then.
More importantly..
Layering
I figured it would be pretty useless to develop a layering GUI since its just one more lib..
Thus I set out to do some basic laying using the standard Processing features.
My Basic results are below
Quote:import processing.opengl.*;
void setup()
{
size (800, 600, OPENGL);
noStroke();
fill(255,255,255,255);
rect(0,0,width,height); // canvas
}
void draw()
{
layer1();
layer2();
layer3();
refreshLayers();
}
void layer1()
{
noStroke();
fill(255,0,0,255);
rect(0,0,width,height);
noStroke();
fill(255,255,0,128);
rect(10,10,width-20,height-20);
}
void layer2()
{
noStroke();
fill(0,255,0,255);
rect(15,15,width-30,height-30);
noStroke();
fill(0,128,128,255);
rect(70,70,width-140,height-140);
}
void layer3()
{
noStroke();
fill(0,0,255,255);
rect(75,75,width-150,height-150);
}
void refreshLayers()
{
noStroke();
fill(255,10);
rect(0,0,width,height); // canvas
}
Quite simply, every object Stacks onto the canvas/i.e. background.
I draw my biggest and farthest objects in my First layer(), and move progressively to the foreground.
If I write two rectangles that are beside each other
rect(10,10,10,10); rect(20,10,10,10); ...right ?
The second rectangle is actually On Top of the first. Processing has layered for us already.
How to update layers..
Change the content!
It will update automatically due to refreshLayers();
Good luck everyone!