Shadow lookups in OpenGL 4
If I declare my shadow map texture uniform as a sampler2D value and do the comparison myself, shadow maps work perfectly:
If I declare my shadow map texture uniform as a sampler2DShadow and call texture(), shadow lookups always return zero (appear black):
if (shadowcoord.z>texture(texture5,shadowcoord.xy).r) attenuation=0.0;
In the second situation, I also set these values for the bound texture on the client side:
attenuation *= texture(texture5,shadowcoord);
- The shadow map lookup returns zero even if I set the shadowcoord.z value to 0.0.
- I also tried changing the compare function to GL_GEQUAL, with the same result.
Something is obviously wrong here. Am I missing some other little trick with OpenGL 4 shadow mapping?