Jump to content
  • Advertisement
Sign in to follow this  
DvDmanDT

Loading a texture from raw data?

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

How can I load a texture from raw data? Meaning a fileformat without a header or a custom format.. I know the size of it (256x256), and the data is stored in A8R8G8B8 format, uncompressed.. Basicly, it just needs to be copied onto the texture (the texture is created with D3DXCreateTexture, and has A8R8G8B8 as format).. So, how to do it? I thought about just locking the texture, but that doesn't work if the data is in video memory (which is what I want it to be).. Should I create a temporary texture in system memory, memcpy the data there, unlock, then UpdateTexture on it? Or will that fail too? All help appriciated..

Share this post


Link to post
Share on other sites
Advertisement
You listed one of two ways already:

Either create a temporary texture in system memory and copy from there, or create the target texture in the managed pool, so Direct3d will do the copying to video memory automagically.

Share this post


Link to post
Share on other sites
Managed pool means .NET, doesn't it? Not that way then.. I want to stay away from .NET another while..

So..
CreateTexture, D3DPOOL_SYSTEMMEM as pool? Then Texture->LocRect, and just memcpy to the pointer returned, then unlock, then UpdateTexture?

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!