For me it works (click to toggle):
var gl;
var b = true;
function setup() {
createCanvas(400, 400, WEBGL);
gl = document.getElementById('defaultCanvas0').getContext('webgl');
}
function draw() {
background(0);
noStroke();
fill(255, 200, 30);
rotateY(frameCount * 0.01);
box(200);
fill(30, 200, 255);
rotateY(PI * 0.25);
box(200);
}
function mousePressed() {
if(b) {
gl.disable(gl.DEPTH_TEST);
} else {
gl.enable(gl.DEPTH_TEST);
}
b = !b;
}
Run it at p5.js Web Editor