Jump to content
  • Advertisement
Sign in to follow this  

Locking back buffer

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

i have 2 render buffers: one as screen(R8G8B8) - using color as DWORD parametr, another 16bit(R5G6B5). Render scene 2 times - using diferrent render targets. When i draw object on 16 bit buffer i color it with flat color = object_index*8. On 32 bit buffer i use diffuse color for each point in object. Than i lock 16 bit buffer - trying to get picked object index. D3DLOCKED_RECT lRect; srfBack->LockRect(&lRect, 0, D3DLOCK_READONLY); BYTE* pBits = (BYTE*)lRect.pBits; WORD wPix = pBits[pt.y*lRect.Pitch + sizeof(WORD)*pt.x]; srfBack->UnlockRect(); The problem is - when i have 32 or less objects i get right index value, but if i have 33 objects - 33th index becomes 0, 34th - become 1, and so on.. How i need to lock(or maybe initialize indices) to get right picked object index? Thanks.

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!