Although it's been three years since this was posted, I stumbled upon it while studying the z-buffer in Three.js (version r73). To turn off DEPTH_TEST in the renderer, I had to execute the following steps on Google Chrome Version 47.0.2526.106:
var renderer = new THREE.WebGLRenderer( { antialias: true });
renderer.setClearColor(0xaaaaaa);
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.context.disable(renderer.context.DEPTH_TEST);
document.body.appendChild(renderer.domElement);
var render = function () {
requestAnimationFrame(render);
renderer.render(scene, camera);
};
render();
var gl = renderer.context;
alert(gl.getParameter(gl.DEPTH_TEST));
The crucial line of code is
renderer.context.disable(renderer.context.DEPTH_TEST)
when initializing the renderer.
I initially tried using renderer.setDepthTest(false)
, but it didn't work as expected. I didn't investigate further to determine if this issue was specific to my project, a known bug, or possibly a removed feature. For now, I suggest sticking to the method described above for reliable results.