I have a shader that does a two pass Gaussian blur on a GL_RED texture. Now I want to blur a depth buffer. Is it possible to use a FBO with the output to a depth texture in GL_COLOR_ATTACHMENT0? It didn't work when I tried.

If this is not possible, do I have to make another blur filter, that blurs the depth instead of the pixel color?

The purpose is to implement Exponential Shadow Maps (ESM).

A follow-up question: I need to allocate two depth buffers, to have the blurring shader alternating outputs to use. This is a little costly, but I don't see any way around this?