Jump to content
  • Advertisement
Sign in to follow this  
sebv

Read the Zbuffer through a texture

This topic is 4860 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

Hi, I'm trying to read the Zbuffer through a texture. 1. I first create the texture for the colorbuffer l_hr = GlobalDevice.GetDevice()->CreateTexture( m_target_desc.m_width, m_target_desc.m_height, m_target_desc.m_mips, D3DUSAGE_RENDERTARGET | (m_target_desc.m_automipmap ? D3DUSAGE_AUTOGENMIPMAP : 0), D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_target_texture, 0 ); m_target_texture->GetSurfaceLevel( 0, &m_target_surface ); 2. then I create the texture for the depthstencil: l_hr = GlobalDevice.GetDevice()->CreateTexture( m_target_desc.m_width, m_target_desc.m_height, 1, D3DUSAGE_DEPTHSTENCIL, D3DFMT_D24S8, D3DPOOL_DEFAULT, &m_target_depth_texture, 0 ); m_target_depth_texture->GetSurfaceLevel( 0, &m_target_depth_surface ); Everything is properly rendered, with proper Z sorting etc but m_target_depth_texture (texture supposed to contain the zbuffer content) is always white. Any idea? Thank you in advance

Share this post


Link to post
Share on other sites
Advertisement
I presume you're verifying the contents are white via a IDirect3DTexture9::LockRect() operation?

If so, you're out of luck:
Quote:
The only lockable format for a depth-stencil texture is D3DLOCK_D16_LOCKABLE.


hth
Jack

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!