Advertisement Jump to content
Sign in to follow this  
thuong

LOCK RECT FAIL

This topic is 4750 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 all, i have code : g_pd3dDevice->GetDepthStencilSurface( &pRenderSurface ) if (FAILED(pRenderSurface->LockRect(&lockedRect, NULL, D3DLOCK_READONLY | D3DLOCK_NOSYSLOCK))) { MessageBox (g_hWnd_1, "Lock failed0", "ERROR", MB_OK); } it fail, pls help me????? thanks very much David,

Share this post


Link to post
Share on other sites
Advertisement
Generally speaking you can't lock a depth/stencil buffer. Only if it's created with D3DFMT_D16_LOCKABLE will this call succeed. However, hardware support for that format is far from universal...

Your best solution is to use some form of "render to texture" effect to try and extract the information you desire. Locking a render target is fairly straight forward and doesn't tend to have format restrictions.


Also, two minor requests from your friendly neighbourhood moderator [wink]
- an ALL CAPITALS subject title isn't necessary.
- Small fragments of code like you posted are best off in [ code ] ... [ / code ] blocks


Cheers,
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!