Looping between DEPTH_TEST disable/enable

edited December 2017 in Questions about Code

in this case, let's assume creating two different loops (one for 2D casting, one for 3D) is not an easy task.

Does this going in out depth test can lead to some issues in frame rate, gpu processing, etc? Same question, regarding the camera matrix transformation in a loop.

Thanks!

`String [] texts = { "why", "is", "this", "?"};

PMatrix original; PMatrix camera;

void setup() { size( 500, 500, P3D); original = getMatrix((PMatrix3D)null);
}

void draw() { background(200);

camera( 50, -50, 50, 0, 0, 0, 0, 1, 0 ); camera = getMatrix((PMatrix3D)null);

for(int i = 0; i < 4; i++){

//resetMatrix();
//applyMatrix(original);
//above is same as:
camera();

hint(DISABLE_DEPTH_TEST);
fill(0);
text( texts[i], 40 * i + 20, 20);
hint(ENABLE_DEPTH_TEST);

resetMatrix();
applyMatrix(camera);

fill(-1);
pushMatrix();
translate(-15 + i*15,0,0);
box(10);
popMatrix();

}

}`

Sign In or Register to comment.