Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Questions about draw function

$
0
0

The following is my code.

Since I am using PeasyCam and thenShapes3D for the box, do I need to ask this question in the Libraries area also?

The question I have is that I am only changing 1 box every second or so, but i am having to redraw all 8000 blocks each draw cycle. Is there a way to have draw only redraw the changed objects?

void draw() {
  int CPS=20;
  pushMatrix();
  for (int i = 0; i < CPS; i++) {
    for (int j = 0; j < CPS; j++) {
      for (int k = 0; k < CPS; k++) {
        box[i][j][k].draw();
      }
    }
  }
  popMatrix();
  cam.rotateY(rotateAngle);
  cam.rotateX(rotateAngle);
  cam.rotateZ(rotateAngle);
}

Viewing all articles
Browse latest Browse all 2896

Trending Articles