PDA

View Full Version : read depth buffer content.



A027298
10-14-2002, 10:16 PM
Hi gang,

I'd like to read the content of the depth buffer in a texture.

That's what I am assuming:

1. Setup ReadBuffer, to read from depth buffer (But what is the flag?)

2. Use glCopyTexImage2D to read it in a texture.

Am I right with this?

Thanks!

dorbie
10-15-2002, 01:26 AM
You have the right idea, but reading the depth buffer is implied by the data format in the copy call.

Specify a depth internal format for the copy and make sure your texture is of type depth.

You can find the tokens here:
http://www.nvidia.com/dev_content/nvopenglspecs/GL_ARB_depth_texture.txt

bakery2k
10-15-2002, 01:46 AM
As Dorbie said, if you are using ARB_depth_texture, you need only use CopyTex(Sub)Image2D with a format of DEPTH_COMPONENT.
If you are not using this extension and want depth data in a simple 8-bit luminance texture, then you need to do ReadPixels with a format of DEPTH_COMPONENT, and then Tex(Sub)Image.

A027298
10-15-2002, 07:30 PM
Cool, thanks!