I implemented a simple shadow mapping. In a shader I use sampler2DShadow and textureProj when accessing a texture. Then I multiply a color(diffuse and specular) by a shadow value. A depth texture has following parameters:
Code :
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LESS);

A point light is situated close to the object and this is a good occasion to understand how texture clamping works. In the first case I use these settings for clamping:
Code :
GLfloat border[] = {0.0f,0.0f,0.0f,0.0f };
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, border);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);

That give following result: image1

When I change a border color to {1.0f,0.0f,0.0f,0.0f } the entire ground should be illuminated but I get this result: image2 and I don't understand why.