I’m haveing problems to implement shadow mapping to my terrain engine. Right now im trying to get the depth texture correct but I don’t know how to visulize it. First I set the camera at the light position and render to a texture using
glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadowMapSize, shadowMapSize, 0,
GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, shadowMapSize, shadowMapSize);
It looks good when using the frame buffert and GL_RGB in glTexImage2D but when I try to see the depth buffer its just white.
I guess that has something to do with the fact that the depth buffer is just one value per texel and not three (like rgb). I would like to visualize it with a greyscale. Anyone know how to do it?