Rendering to back buffer and FBO


in a program I was writing recently I was trying to write to both the back buffer and a fbo at the same time using mrt’s. I had something like this:



//draw stuff

however, when I bind the fbo, the back buffer is not rendered to and if I don’t bind the fbo then that buffer is not rendered to. This seems like it makes sense, but does anyone know of a way to do this other than 1) using two passes or 2) rendering to two color attachments and then combining them.


There is no way to do this directly.

But you don’t need two passes either, at least if you’re content with the color buffer. Just render to a texture, and then render a fullscreen quad with the texture on it and shaders disabled to the backbuffer. That should cost almost nothing in terms of performance, but of course you’ll need the space for the additional texture.