Grabbing framebuffer pixels

I was reading http://www.opengl.org/wiki/GL_EXT_framebuffer_object

Is it possibile to set up two outputs, one on screen and one on a pixel matrix in memory?

Is it also possible to differentiate the initialization of the two outputs, for instance setting black background in the memory buffer and setting a color image background for the screen output, and then using the same OpenGL graphic primitives just once on both frames?

Can anyone provide some example? Or is there a good repository of examples working on FBO?

Yes, its possible to do make more than one render target at same time.

I got good idea about FBO from this:
http://www.songho.ca/opengl/gl_fbo.html

Yes. GL_Starter answered just this portion of your question. You set up a framebuffer object (FBO) which has multiple color attachments (GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1), you tell glDrawBuffers() about both of these, and then in your frag shader you write to gl_FragData (writes to one) or gl_FragColor (writes to all).

There is also layered rendering supported through geometry shaders.

…one on screen and one on a pixel matrix in memory?

AFAIK, no. This is the part GL_starter missed seeing. You can either have the system framebuffer active (framebuffer 0) OR you can have an FBO active. FBOs only write to off-screen render targets (textures or renderbuffers).

Is it also possible to differentiate the initialization of the two outputs, for instance setting black background in the memory buffer and setting a color image background for the screen output, and then using the same OpenGL graphic primitives just once on both frames?

Yeah, you can initialize the starting contents of the color buffers individually.

Can anyone provide some example? Or is there a good repository of examples working on FBO?

Start with the wiki:

If you have questions just ask!

So there is no way to initialize the window-system-provided framebuffer and the application-created framebuffer in two different ways and then call the OpenGL primitives just once to write on both framebuffers?
I mean, it is possible to initialize two application-created framebuffer in two different ways and then write on both of them with just one OpenGL primitive call, but it is not possible to do the same with an application-created framebuffer (FBO_EXT) and the window-system-provided framebuffer (the old standard screen framebuffer), am I wrong?
If so, can I write on two application-created framebuffer and then display just one of the two on screen? Possibily keeping good performances in realtime? Any advice?

the process goes like this

1)create fbo with two attachments.
2)Bind fbo. This will cause opengl to render to fbo instead of the backbuffer (application-created framebuffer).
3) Render you scene as stated above using gldrawbuffers.
4)At this point you’ll having an fbo with 2 textures containing your data.
5) unbind fbo this will cause all rendering to go to the backbuffer.

You can then bind these textures and do whatever you want to them. The texture data isn’t copied to the client(your cpu) so it’ll be fast

Yes to the former, no to the latter (AFAIK).

I mean, it is possible to initialize two application-created framebuffer in two different ways and then write on both of them with just one OpenGL primitive call, but it is not possible to do the same with an application-created framebuffer (FBO_EXT) and the window-system-provided framebuffer (the old standard screen framebuffer)

As far as I know, that’s right. Though I would rephrase the former to say write to two different textures and/or renderbuffers at the same time via the same FBO.

Note however that you can use the former technique, and then merely Blit the contents of one of the textures (or renderbuffers) onto the system framebuffer. Or render it directly onto the system framebuffer if it’s a texture. The former should be simpler (one call).

If so, can I write on two application-created framebuffer and then display just one of the two on screen? Possibily keeping good performances in realtime? Any advice?

Yes, that’s what I was referring to. When you want to display one of the off-screen targets (a texture or a renderbuffer), just Blit it to the system framebuffer.

Could you tell me what call are you referring to?

Could you tell me what call are you referring to? [/QUOTE]
Rendering a textured quad on the system framebuffer (latter) vs. just calling glBlitFramebuffer to transfer the contents of one framebuffer to another.