How to read depth texture attached to FBO in WebGL2
问题 I'm now working on the deferred shading using WebGL2.0. One primary problem I'm now facing is that I can't read the depth value from the DEPTH_ATTACHMENT. Actually I creat my own GBuffer with a DEPTH24_STENCIL8 texture as DEPTH_ATTACHMENT, then I bind this texture to the sampler and try to read the value in my fragment shader in deferred shading part like this: uniform sampler2D u_depthSampler; vec4 depthValue = texture(u_depthSampler, v_uv); Then I set the depthValue as output in my shading