Alternative to background()

Hi there,

It would be long to explain, but I can’t use background() in my sketch (something related with P3D sketches whose windows are bigger than your display).

So, I though this code would do the same as background(0)

  loadPixels();  
  for (int x = 0; x < width; x++) {
    for (int y = 0; y < height; y++) {
      int loc = x + y * width;
      pixels[loc] = color(0);
    }
  }
  updatePixels();

In fact, this code works. There is just something a little weird: my NVIDIA Antialiasing -Gamma Correction option doesn’t work.

So, if you run the following code in a NVIDIA video card, the visual result is the same with Antialiasing - Gamma Correction On or Off. The antialising gamma correction doesn’t do anything. Very weird.

int z = 0;
int w = 800;
int h = 600;

void settings() {
  size(w, h, P3D);
}

void setup() {
  stroke(255);
}

void draw() {
  //background(0);

  loadPixels();  
  for (int x = 0; x < width; x++) {
    for (int y = 0; y < height; y++) {
      int loc = x + y * width;
      pixels[loc] = color(0);
    }
  }
  updatePixels();

  pushMatrix();
  translate(0, 0, z);

  for (int i = 0; i <100; i++) {
    line(0, 100+2*i, w, 100+2*i);
  }
  popMatrix();
  z = z -10;
  saveFrame("frame-###.png");
}

Any idea? Any other alternative to background(0). I have tried several things. Nothing works.

Thanks!