PDA

View Full Version : Depth-Buffer -> Frame Buffer



Falkenbach
05-06-2004, 04:43 AM
Hi Folks!

Stupid question maybe, but is it possible to render or move the values from the Depth-Buffer to the frame-Buffer, so i can grab them there as an image or draw the values to the screen?

Thanks

Chris

plasmonster
05-06-2004, 05:07 AM
Falkenbach,

glReadPixels(...) with a GL_DEPTH_COMPONENT will give you the contents of the depth buffer directly.

Corrail
05-06-2004, 05:34 AM
If you work on a NV card you can also try:
NV_copy_depth_to_color
http://oss.sgi.com/projects/ogl-sample/registry/NV/copy_depth_to_color.txt

Or you can do it with EXT_pixel_buffer_object using glReadPixels/glDrawPixels.

Every other way using glReadPixels/glDrawPixels (without EXT_pixel_buffer_object) is very very inefficient because all data has to be transfered from GPU to CPU and at last back to the GPU.

Falkenbach
05-06-2004, 05:37 AM
Thanks for the quick answer :)

I know about Readpixel(), but unfortunately i think i can't use it, as i need the data for an application i want to use in the frame-buffer.

And i think Readpixel is quite slow, afaik...

Nevertheless thanks for your reply!

Corrail
05-06-2004, 05:43 AM
glReadPixels ist slow, yes. But if you use it with EXT_pixel_buffer_object there is not much performance loss.