MRT

Is it possible to render to the backbuffer and a FBO at the same time?
The GL 2.1 spec doesn’t talk about FBOs, so I refered to the GL 3.0 spec.
p 256 says

Table 4.5: Arguments to DrawBuffer(s) and ReadBuffer when the
context is bound to a framebuffer object, and the buffers they indicate.
i in COLOR ATTACHMENTi may range from zero to the value of
MAX COLOR ATTACHMENTS - 1.

Not as far as i know. The moment you bind an FBO other than 0, you can only render to render-buffers and textures, i do not know of any way to bind the back-buffer as a render-target.

Jan.

Nope you can’t (i tried).
you either render to the front and/or back buffers or to FBO buffers.

I really wonder if it is an hardware limitation or just an API limitation. It could be great to be able to the use any framebuffer layer as attachments so that we don’t need to reserve extra memory to the depth and stencil buffer for example. Any clue on the possible limitation for that?

It’s not a hw limitation but probably a window system interaction difficulty for GL. This is possible in DX, but only because the system framebuffer color target is exposed explicitly as a texture (though in practice I’ve not had much use for it).

Of course we can access the framebuffer depth attachment texture via say GL_NV_depth_buffer_float, which is supported even on my HD4650 (though misreported as GL_EXT_depth_buffer_float in the extension string).