can i store and restore the value in z-buffer

Hi, everybody, i want to store and restore the z-buffer value. glpushattrib only can save some mask value and testing flag, but can’t save what i wish, does anybody know, is there any function (for example something like pushmatrix & popmatrix) that can store and restore z-buffer value? thx!

Normally with glReadPixels(,GL_DEPTH_COMPONENT,) and glDrawPixels(). Beware of destination formats which don’t match the depth buffer size. GL_FLOAT will be slow, GL_UNSIGNED_INT might be fast.

If you don’t use it for a hierarchy like glPush-glPop and only a single save-restore is needed, the fastest might be GL_KTX_buffer_region or the newer WGL_ARB_buffer_region extension.
They don’t offer an interface to access the stored memory, so it can be moved around in the hardware’s native format.

[This message has been edited by Relic (edited 10-21-2002).]