MRT + PBuffer

I need to execute a GLSL program that writes to gl_FragData[0] and gl_FragData[1] in a p-buffer. What should I pass to glReadBuffer to read the result back for buffers > 0?

I tried glReadBuffer ( GL_AUX0 ), etc. but I get garbage…

What makes you think MRT works with pbuffers? And why would you want to use pbuffers?

What makes you think GL_AUX0 would work for a pbuffer?

On windows try to use WGL_AUX0_ARB enum,
and use ARB_render_texture extension !!! instead readback buffer’s content

Or still better use FBO :wink:

While it’s useful feedback, none of these responses helps answer flamz’s beginner’s-level question about how to use MRT.

Why wouldn’t MRT work with pbuffers? A pbuffer can have front and back buffers as well as AUX buffers.

gl_FragData[n] gets written to the buffer specified in the Nth slot of the draw_buffers array. Read the definition of glDrawBuffers in the core GL spec.

To read from buffer N, you first pass to glReadBuffer the name of the buffer that was in slot N of your draw_buffers array.

glDrawBuffers works with windows, pbuffers, and FBOs. FBO is preferred over pbuffer these days; FBO is meant to eventually replace pbuffer. When using FBO you need to read the section of the EXT_framebuffer_object spec that modifies the language defining the glDrawBuffer operation. FBOs and non-FBOs have different sets of names that are legal in the draw_buffers array.

obvisouly not such a beginner’s-level question considering top-rated Leghorn didn’t even know pbuffers could have MRTs.

Thanks for answering. Of course, if I had the luxury of using FBO, I would. Since I am writting an application that targets multiple chipsets, vendors, OSes, I have to have a bunch of different codepaths that goes around driver/card limitations.

My problem is that I thought, for some unknown reason, that glDrawBuffers was a FBO-related extension… pretty dumb.

works now.

tx

There are cards out there that do support MRT but don’t support FBO? Wow, I didn’t know that :wink: