Setting up textures for MRT in GLSL

Heya

I’m looking at doing deferred rendering in GLSL using Multiple Render Targets. I don’t know how I am supposed to set up textures for this from the main program. Can anyone help or point me to info about how this should work?

Thanks!

You need to learn about framebuffer objects. A framebuffer object lets you render into textures instead of windows. The cool thing about it is that each fbo has a number of “attachment” points. These range between depth, stencil and color attachments. On most hardware, there exist a number of color attachments which lets you attach multiple color textures onto the same fbo. Then you have to use special variables in the GLSL shader to control which color attachment the different “colors” are rendered into.

I’d recommend going through the opengl spec for 3.0 or 4.0 because they pretty thorough explanations of how framebuffers are used. Then I’d do simple render-to-texture work first. Once that works, deferred rendering is fancy rendering to textures from the MRT side.

HTH

Sweet - that sounds like really good advice. I’ll see if I can hunt down the OGL3 spec.

Thanks for the info!