//current code (not entirely correct)
if(format == D3DFMT_A2R10G10B10)
{
for(int y=0; y<desc.Height; y++)
{
DWORD* pPixel = (DWORD*)(((BYTE*)theRect.pBits) + (y*theRect.Pitch));
for(int x=0; x<desc.Width; x++)
{
BYTE alpha = (*pPixel&0xff000000)>>30;
unsigned short red = (*pPixel&0xff0000)>>20;
unsigned short green = (*pPixel&0xff00)>>10;
unsigned short blue = (*pPixel&0xff);
pPixel++;
}
}
}
A2R10G10B10 readback woes
hi!
this is another of my readback woes again. I managed to solve the last one on G16R16 by using a WORD directly instead of a D3DXFLOAT16. This time I found that my current code for A2R10G10B10 readback is not correct. Unfortunately, I dun seem to understand how the bitshifting should work...
perhaps someone or Jack can enlighten me again...
thx!
Edwin
Your shifting is OK but masks are wrong.
Try this:
Try this:
BYTE alpha = ((*pPixel)>>30) & 0x3;unsigned short red = ((*pPixel)>>20) & 0x3FF;unsigned short green = ((*pPixel)>>10) & 0x3FF;unsigned short blue = (*pPixel) & 0x3FF;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement