Sign in to follow this  
Black_Moon

Locking back buffer

Recommended Posts

Black_Moon    122
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

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