Questions about draw function

edited November 2016 in Library Questions

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);
}

Answers

Sign In or Register to comment.