tags:

views:

192

answers:

1

I'm trying to get MRT working in OpenGL to try out deferred rendering. Here's the situation as I understand it.

  1. Create 3 render buffers (for example). Two RGBA8 and one Depth32.
  2. Create an FBO.
  3. Attach render buffers to FBO. ColorAttachment0/1 for color buffers, DepthAttachment for depth buffer.
  4. Bind the FBO.
  5. Draw geometry.
  6. Send data to different attachments using gl_FragData[] in the frag shader.

At this point I would want to take the data in another pass using GLSL, how can a) retrieve data from the framebuffer color attachments, b) get data from the depth component.

+1  A: 

What are you using as FBO attachments? Renderbuffers? Textures?

You should be using textures as color attachments (and depth attachments), so you can read them in the next pass. There's no way to do the same with a renderbuffer.

Matias Valdenegro
I was using renderbuffers (see #3 in question) as I was never going to use generated images as texture maps on geometry. I suppose I would be better off using textures as attachments instead and map them onto a screen-aligned quad in the second pass?
Tom Savage
Yes, exactly, textures is the way to go.
Matias Valdenegro