Skip to main content
gamedev.net
🔒 Locked

Locking back buffer

Started by Black_Moon Dec 3, 2005 at 9:52 AM 0 replies 400+ views
Original Post
Black_Moon
Black_Moon
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.