Jump to content
  • Advertisement
Sign in to follow this  
Sai Adikarla

Reading the stencil values

This topic is 3633 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 there, I was trying to read the stencil buffer in the following way: HRESULT hr; D3DSURFACE_DESC Desc; IDirect3DSurface9 *pSourceSurface = NULL; IDirect3DSurface9 **pDestSurface = NULL; hr= g_pd3dDevice->GetDepthStencilSurface(&pSorceSurface); if( SUCCEEDED(hr)) { pSorceSurface->GetDesc(&Desc); hr = g_pd3dDevice->CreateDepthStencilSurface( Desc.Width, Desc.Height, Desc.Format, Desc.MultiSampleType, Desc.MultiSampleQuality, FALSE, pDestSurface, NULL); if( SUCCEEDED(hr)) { hr = g_pd3dDevice->StretchRect(pSorceSurface, NULL, *pDestSurface, NULL, D3DTEXF_NONE); } } I could successfully execute the StretchRect method. Now, from here how do I get the stencil values to perform other operations? Had it been the render target, I could have used LockRect() to read the buffer. Since the current format is D3DFMT_D24S8, I can't lock this buffer for read. Any help in this regard is highly appreciated. Please note that apart from StretchRect(), none of the methods like GetRenderTargetData() or UpdateSurface() are not working. Thanks, Sai.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!