PDA

View Full Version : Z buffer save/load?



Artemiy
11-28-2009, 12:10 PM
Hello!

Here I go again with a stupid question.

Is it possible to save/load the depth buffer (without the use of shaders)? I was recommended to use glCopyTexImage to save the depth buffer into a texture, but no idea how to load it back...

Thank you very much in advance.

ZbuffeR
11-28-2009, 05:09 PM
Simply using glReadPixels (save) and glDrawPixels (load) with GL_DEPTH_COMPONENT should do fine, no need for glCopyTexImage.
Check the man page for details:
http://www.opengl.org/sdk/docs/man/

However the drawpixels will fill both depth *and* rgba, with current color.

Artemiy
11-29-2009, 12:16 AM
Thank you very much, worked perfectly, in the end was too slow though, but nevertheless, much gratitude!