glCopyPixels for depth buffer

I am using a pbuffer to quickly save/restore color and depth information. I am looking for something that will work on radeon (ideally on older radeons, too), which rules out ktx buffer regions and wgl arb buffer regions.

ATI’s suggestion was to use wglMakeContextCurrentARB followed by glCopyPixels. It’s working great for color values, but not when I try depth:
glRasterPos2i(area->left, area->bottom);
glCopyPixels(0, 0, w, h, GL_COLOR );
if( z_buffering )
glCopyPixels(0, 0, w, h, GL_DEPTH );
which gives results as on the screen grab shown here:
I am currently testing on an 8500, but have seen similar results when running on a 9800 pro.

glCopyPixels using GL_DEPTH is supposed to copy depth values into depth values, right? What am I missing? Why is the color buffer getting trashed by the GL_DEPTH copy? Do I need a call to glPixelMap or something?

Based on what I saw here:;f=3;t=010024
I had expected the results to look correct, but perhaps slow on older radeons.

What’s the best way to save and restore the depth buffer on radeons?


I talked to Evan Hart at ATI, and he said that this looked like it might be a bug in the ATI drivers.

One argument in favor of that conclusion is that the trashed area of the color buffer appears black on radeon 9800, but white on radeon 8500 (as shown in the link posted).