var extension = gl.getExtension('OES_depth24'); if(extension !=== null){ var depth = gl.createRenderbuffer(); gl.bindRenderbuffer(gl.RENDERBUFFER, depth); gl.renderbufferStorage(gl.RENDERBUFFER, extension.DEPTH_COMPONENT24_OES, 128, 128); gl.bindRenderbuffer(gl.RENDERBUFFER, null); var fbo = gl.createFramebuffer(); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depth); var fboStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER); console.assert(fboStatus == gl.FRAMEBUFFER_COMPLETE, 'Framebuffer is not complete'); gl.bindFramebuffer(gl.FRAMEBUFFER, null); console.assert(gl.getError() == gl.NO_ERROR, 'A GL error occured'); }