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; fbo.allocate(s);
Then in draw()
fbo.begin(); //do the drawing fbo.end(); //this does not work depth.getDepthTexture().draw(0, 0);
Thanks for help and sorry for bad English.