How to make blurs run independently in custom functions?

edited February 2016 in Questions about Code

I'm fairly new to processing, and I am trying to make a space scene in which the stars in the background are blurred, and there is another very blurred large star. and it leaves the planet untouched. My problem is that when I apply a blur, it applies to all parts of the sketch. Is there a way to get around this?

Code:

void setup () {
  size (900, 506);
  background (0, 0, 12);
  drawStars ();
  drawPlanets ();
  drawLargeStar ();
}

void draw () {
}

void drawPlanets () {
  drawPlanet (300, 110, 50);
  pushMatrix ();
  scale (.1);
  drawPlanet (1000, 1000, 100);
  popMatrix ();
}

void drawPlanet (int x, int y, int grey) {
  translate (x, y);
  stroke (0);
  fill (150, 150, 255);
  ellipse (0, 0, 708, 698);
  fill (255);
  ellipse (0, 0, 697, 687);
  fill (grey);
  ellipse (0, 0, 680, 680);
}

void drawStars () {
  for (int num = 0; num < 400; num++) {
    fill (255);
    stroke (random (0, 255), random (0, 255), random (0, 255));
    ellipse (random (0, 900), random (0, 506), random (1, 8), random (1, 8));
  }
  filter(BLUR, 4);
}

void drawLargeStar () {
  fill (255);
  stroke (255);
  ellipse (450, 200, 150, 150);
}
Sign In or Register to comment.