View Full Version : MRT + PBuffer

08-29-2006, 03:16 PM
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...

09-07-2006, 07:09 AM
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?

Nikolai Timofeev
09-07-2006, 07:51 AM
On windows try to use WGL_AUX0_ARB enum,
and use ARB_render_texture extension !!! instead readback buffer's content

09-07-2006, 09:56 AM
Or still better use FBO ;)

09-08-2006, 03:45 PM
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.

09-10-2006, 10:17 AM
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.


09-11-2006, 12:35 PM
There are cards out there that do support MRT but don't support FBO? Wow, I didn't know that ;)