I’m working on a shader using sampler2DShadow target and making depth comparison with shadow2D function. Everything works well, but now I would like to get also the depth value. I know that I can use sampler2D target with texture2D lookup function, but I would like to continue using the sampler2DShadow target. Is there a way to get depth values with this target?
texture2D() has a sampler2D parameter. No way to use the sampler2DShadow with it.
You can easily bind the same texture to two samplers (texture image units).
Correct, there is no way to get the floating point data from the depth texture on a unit which is configured to return a true/false decision with the r_to_texture comparison mode.
Again, you need to bind the same texture image to two differently configured texture image units and access these as two different samplers inside the shader.
Because TexParameters are texture object state you need to have two different texture objects for that, duplicating the downloaded depth texture data. That’s just how OpenGL is.