I’ve added the shadowmap example to the OpenGL 4 Tutorial Code (Red Book) page.

I had to change

    glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, depth_texture, 0);

to

    glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depth_texture, 0);

otherwise I get GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT from

 
glCheckFramebufferStatus(GL_FRAMEBUFFER);

Not sure why this happens. (Driver is NVIDIA 340.24 on Ubuntu 14.04)