Jump to content
  • Advertisement
Sign in to follow this  
dave

What Data Format Shoulsd I Use

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

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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Umm, maybe i should have explained, this is a lock rect on a surface not a texture, probably similar, but basically i need to know how toread the color of a pixel within that rect and im nnot sure how...


ace

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!