Even though it's called background, this doesn't mean it automatically goes to the background. What happens depends on where/when you call background in your sketch. See these three examples...
1. Background is called once in setup, after that the drawing is accumulative.
Code:void setup() {
size(400,400);
background(255,0,0);
}
void draw() {
ellipse(mouseX,mouseY,50,50);
}
2. Background is called every time at the beginning of draw, thereby creating a 'clean slate'. In fact it is just drawing over everything that was drawn before.
Code:void setup() {
size(400,400);
}
void draw() {
background(255,0,0);
ellipse(mouseX,mouseY,50,50);
}
3. Background is called at the end of draw. This is perhaps what you are doing right now. It basically draws over everything that was just drawn in this draw cycle. The result is you only see the 'background'.
Code:void setup() {
size(400,400);
}
void draw() {
ellipse(mouseX,mouseY,50,50);
background(255,0,0);
}
So the solution to your problem is to call the background either once in setup or place it at the beginning of draw.