Using the output of one fragment shader as the input in another fragment shader

I have created a framebuffer, imported 3d vertex information into it and rendered it. The fragment shader has two outputs (a colour texture and a depth buffer), which are written in to GL_COLOR_ATTACHMENT0+0 and GL_COLOR_ATTACHMENT0+1 via glDrawBuffers (and gl_FragData[0] and gl_FragData[1] in the fragment shader).

I want to now use these outputs for post-processing in the default framebuffer (i.e. to screen). How can I take the outputs of the first fragment shader and use them in the second fragment shader? I want to bring them into the second fragment shader using ‘uniform sampler2D xxxx’.

Unfortunately I am not very familiar with OpenGL, and so any help gratefully received. I am using OpenGL 4.0 and GLSL version 400.

[QUOTE=angusM;1277064]I have created a framebuffer, imported 3d vertex information into it and rendered it. The fragment shader has two outputs (a colour texture and a depth buffer), which are written in to GL_COLOR_ATTACHMENT0+0 and GL_COLOR_ATTACHMENT0+1 via glDrawBuffers (and gl_FragData[0] and gl_FragData[1] in the fragment shader).

I want to now use these outputs for post-processing in the default framebuffer (i.e. to screen). How can I take the outputs of the first fragment shader and use them in the second fragment shader? I want to bring them into the second fragment shader using ‘uniform sampler2D xxxx’.[/QUOTE]
Create both the colour and depth buffers as textures (not renderbuffers) and attach them to the FBO using glFramebufferTexture() (or glFramebufferTexture2D()). Once you’ve unbound the FBO (i.e. reverted to the default framebuffer), you can then bind those textures to texture units and access them via sampler2D uniforms, as with any other texture.