Archived

This topic is now archived and is closed to further replies.

Saving and restoring depth values

This topic is 5541 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The problem is this. I want to save the values from the depthbuffer so I can reload them later. I know there is a way of doing this by using glReadPixels and glDrawPixels like this:
  
glReadPixels( 0, 0, width, height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, *zbuffer );
  
and whenever it should be restored:
  
glDrawPixels( 0, 0, width, height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, *zbuffer );
  
I''ve heard that this is possible doing fast (since using glRead and glDraw pixels is slow as H*LL) using pbuffers. Does anyone know how to do it? And if anyone know how to do it without extensions it would be even more appreciated. -Luctus

Share this post


Link to post
Share on other sites
>>using pbuffers. Does anyone know how to do it? And if anyone know how to do it without extensions it would be even more appreciated. <<
pbuffer IS an extension. theres nothing wrong with extensions btw think of them as newer versions of opengl (which they are all they do are expansions of the original opengl 1.0 sspec)

check all wgl_buffer_region demo at www.delphi3d.net


http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
Thanks for the link, very usefull page indeed.

And yes, I know pbuffers are an extension, I asked if anyone knew a way of storing the depth buffer without using extensions.

Also, using extensions limits the hardware that are able to run the application, therefor I try to use as few extensions as possible and try to use those that are widely supported.

-Luctus

Share this post


Link to post
Share on other sites