PDA

View Full Version : glCopyPixels for depth buffer



heppe
03-29-2004, 04:05 PM
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:
http://developer.hoops3d.com/downloads/copypixels.jpg
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:
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;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?

Thanks!

heppe
03-30-2004, 11:35 AM
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).