The line is over the ellipses,why? It should be under it:
So it seems like DISABLE_DEPTH_TEST is not working.
Is there a way to fix?
void setup() {
size(640, 480, P3D);
}
void draw() {
background(0);
rotateX(random(TWO_PI));
rotateY(random(TWO_PI));
rotateZ(random(TWO_PI));
begin_2d();
stroke(255,0,0);
line(0, 0, width, height);
fill(255);
ellipse(0, 0, 50, 50);
ellipse(width, height, 50, 50);
end_2d();
}
void begin_2d() {
hint(DISABLE_DEPTH_TEST);
pushMatrix();
resetMatrix();
ortho(0, width, -height, 0, -Float.MAX_VALUE, Float.MAX_VALUE);
}
void end_2d() {
popMatrix();
hint(ENABLE_DEPTH_TEST);
}