Sign in to follow this  
niblick

D3DXCreateTextureFromMemoryEx

Recommended Posts

i've been having some trouble coming up with any documentation for "D3DXCreateTextureFromMemoryEx". i need to generate a texture and can't find out how to make my 'texture data' into an actual d3d 'texture'. thanks

Share this post


Link to post
Share on other sites
Does that function exist?

Try doing this: Create a texture using IDirect3DDevice9::CreateTexture or D3DXCreateTexture, then use IDirect3DTexture9::GetSurfaceLevel to access the texture's image data (as a surface). There is lots more involved, but that should get you going.

Share this post


Link to post
Share on other sites
Indeed it does exist, I don't remember the spefics but look it up in the DX-SDK. It may have been removed in DX-9. I'd have to see but I am at school atm.

Share this post


Link to post
Share on other sites

the only reference to it i could find was at this site. i have been looking about for alternatives and saw you can access the texture as a surface but i don't know how to directly copy memory over to it?

msdn doesn't seem to have 'D3DXCreateTextureFromMemory' which has been confusing me as it tends to retain legacy functions does it not?

Share this post


Link to post
Share on other sites
ok. i finally got on my computer and checked the sdk doc's.

it seems the function in question has been ommited from dx9 but has been replaced by 'D3DXCreateTextureFromFileInMemory'.

should be able to knock up a quick bmp header to attach to my data and load it in :)

would have been nice for the original to be on msn with a note redirecting you to the replacement.

Share this post


Link to post
Share on other sites
If you're thinking of the same thing I am, the actual function is D3DXLoadSurfaceFromMemory(). You have to already know the size/format of your image data, and create a texture. Then you grab the primary (or only) surface from the texture and and use the above function to load the data into it from memory. (Of course, you don't have to create a texture; you could create a surface another way, for example an off screen plain surface.)

Share this post


Link to post
Share on other sites
for completeness.
if anyone else finds themselves looking ot use this function a way round can be carried out using the 'D3DXLoadSurfaceFromMemory' function alongside the 'D3DXCreateTexture' and 'GetSurfaceLevel' functions.

isn't this just manually doing what 'D3DXCreateTextureFromMemory' would have performed?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this