PDA

View Full Version : Bindless Textures and sampler2DShadow



Christoph.LGDV
02-09-2017, 04:55 AM
Hi,


I want to sample a depth texture with a shadow sampler.

The texture is bindless and the homebrewed depth sampling/compare works as expected.


Now I would like to creeate a shadow sampler.

Code compiles:



sampler2DShadow sShadow = sampler2DShadow(shadowTex);
float isShadow = texture (sShadow, vec3(shadowTC, distanceToLight)).x;
out0 = vec4(isShadow);

I tried several "distanceToLight" values but "isShadow" remains 0.

Am I missing something?
Solved:

Yes I was: The shadow sampler must be enabled.

glTextureParameteri(shadowTex, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
glTextureParameteri(shadowTex, GL_TEXTURE_COMPARE_FUNC, GL_LESS);