Skip to main content
GameDev.net gamedev.net
🔒 Locked

Loading a texture from raw data?

Started by DvDmanDT Jan 8, 2005 at 1:05 PM 2 replies 850+ views
Original Post
DvDmanDT
DvDmanDT
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..
Endurion
Endurion
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.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>
DvDmanDT
DvDmanDT
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?
DrunkenHyena
DrunkenHyena
The Managed Pool and Managed DirectX have nothing to do with each other. It's just a coincidence of naming.
Stay Casual,KenDrunken Hyena</FON

Topic Locked

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

Sign in to reply to this topic.