View Full Version : How to use ATI_draw_buffers?

03-19-2004, 05:58 AM
I would like to use ATI_draw_buffers to allow my fragment programs to output some additional data for post-processing purposes.
The problem is that when I try to set up additional buffers with glDrawBuffersATI() (for example: GL_BACK as first buffer, GL_FRONT_LEFT as second and GL_FRONT_RIGHT as third), the binding stays the same as before call to glDrawBuffersATI() (that is: GL_BACK, GL_NONE, ...).
I have read somewhere that Win32 doesn't support stereo-buffering so maybe that's my bad. But how should I use this extension then?
When I query the number of AUX buffers, I get 0 as result.
If any one could give me an example on how to use this extension, I would be very grateful.

By the way: I use wxWidgets as windowing system for my OpenGL application and ATI Radeon 9700 as hardware.


03-21-2004, 10:13 PM
You may need to allocate AUX buffers when you create your rendering context. I think you will need to tell CreateContext that you need AUX buffers.

Off-topic: Advance forums are back up. Yay!

03-22-2004, 01:38 AM
You may need to allocate AUX buffers when you create your rendering context. I think you will need to tell CreateContext that you need AUX buffers. Ok, and how do I do that?
Excuse me, if that's a noob question, but my topic got kicked out from beginners forum here.
I try to set pixel format descriptor to use aux buffers, but it doesn't work (number of GL_AUX_BUFFERS still is 0).

03-22-2004, 04:54 AM
Try to use WGL_ARB_pixel_format!

03-22-2004, 07:45 AM
Try to use WGL_ARB_pixel_format! Doesn't help, still 0. Even when I try to setup a pbuffer with any aux buffers in pixel format, I get 0 as a value of GL_AUX_BUFFERS :( .

03-22-2004, 03:02 PM
i've once done it by rendering at the same time to front and back buffer (and left right you can choose from, too, i guess).

if you can set up a double-buffer-p-buffer, then it should at least give you 2 targets to write to, possibly even 4 if left-right works.

that should help (but i never tried it with p-buffers)

03-23-2004, 12:40 AM
Haven't used ATI_draw_buffers, but if you don't get aux buffers that means the OpenGL implementation hasn't implemented them.
If you don't get stereo, it also means it's not supported or the pixelformats with stereo are not exported. They normally need to be unlocked in some control panel. I guess the Radeon 9700 has no driver support for either and P-buffers seems to be the only choice.

03-23-2004, 03:25 AM
*hm* This code here gives me a number of 24 different pixel formats:

int properties[] =

int formats[100];
unsigned int num_formats;

wglChoosePixelFormatARB(hdc, properties, NULL,
100, formats, &num_formats);[EDIT]: Catalyst 4.3; Radeon 9800 Pro

03-25-2004, 02:43 AM
After one day of trying to make this working, I finally succeeded! :)
From the beginning I was trying to avoid using extensions dependent on wgl or glx, but pbuffers have proven to be the only reasonable solution.
Btw. I spent most of the time trying to fix a bug that I doubt is on the application side. My lens flares, which are build around ARB_point_sprite failed to display after I moved from Catalyst 4.2 to 4.3. I not sure if this is driver bug, if it isn't please let me know.
Again, big thx to all you guys for your input!

Brian Paul
03-26-2004, 08:17 AM
Were you really trying to pass GL_BACK to glDrawBuffersATI()? That's illegal. Read the spec. Only GL_FRONT_LEFT, GL_BACK_LEFT, GL_FRONT_RIGHT, GL_BACK_RIGHT, GL_AUXn and GL_NONE are legal values.


03-26-2004, 10:12 AM
I meant GL_BACK_LEFT, but the problem laid somewhere else. I called glDrawBuffersATI() in my OpenGL initialization routine, then I checked the binding just before sending geometry for drawing. I don't know for sure what was happening in the mean time (maybe some wxWindgets camouflaged context switching), but the binding returned to default state. Now I call glDrawBuffersATI() just before issuing draw commands and everything seams to work just fine.