What Data Format Shoulsd I Use
Ok so ive got a pointer the bits in a locked rectangle, but what data format are theyb stored in, so i can memcpy them to an array?
ace
Quote:Original post by ace_lovegrove
Ok so ive got a pointer the bits in a locked rectangle, but what data format are theyb stored in, so i can memcpy them to an array?
ace
The format of the data will be in whichever format the surface/texture was created in.
If you didn't create the texture yourself (perhaps due to using something such as D3DXCreateTextureFromFile() which decided on a format for you), then you can use IDirect3DTexture9::GetLevelDesc() to find out.
The name of the format tells you how it's layed out in memory; D3DFMT_R5G6B5 for example means 5-bits of red, then 6-bits of green, then 5-bits of blue, and 5+6+5=16 so each pixel is 16-bits or a "WORD" wide. Another example, D3DFMT_X8B8G8R8 means 8 unused bits (X8), followed by 8 blue bits (B8), 8 green bits (G8) and finally 8 red bits (R8); 8+8+8+8=32=DWORD.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement