Sign in to follow this  
Sai Adikarla

Reading the stencil values

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this