Bind FBO depth

Hello all OF users,
I have a small problem. I am learning GLSL shaders and I have already done some nice per-pixel lighting and light scattering and now i want to try some DOF. But what i need is depth image of my scene (greyscale image with different darkness for every depth). I know i should use FBO and i can use them as textures, but cant figure out how to bind it as depth texture. Can somebody post short code how to set up such FBO and bind it?

Here is how i set FBO in setup()

ofFbo::Settings s = ofFbo::Settings();  
s.width = WIDTH;  
s.height = HEIGHT;  
s.useDepth = true;  
s.useStencil = true;  
s.depthStencilAsTexture = true;  

Then in draw()

//do the drawing  
//this does not work  
depth.getDepthTexture().draw(0, 0);  

Thanks for help and sorry for bad English.

Are you seeing black when you draw the depthTexture or nothing? If you’re seeing black, it’s probably because your depth values are very small, or maybe even negative, so they won’t appear correctly. If you’re seeing nothing, you might have another problem. Using that texture in a shader means you bind it and then start your shader, then pass the name of the shader to the index of the texture:

shader.setUniform1f("colorTex", 0);  
shader.setUniform1f("depthTex", 1);  

Thanks for answer, when i draw depth all I see is white screen. Now i figured out it works when i dont use ofEasyCam, which I used for setting viewport without calling the gl functions myself. So I guess i will just stop using it, but thanks for help.