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

D3DXCreateTextureFromMemoryEx

Started by niblick Apr 4, 2006 at 1:17 PM 5 replies 3.2k views
Original Post
niblick
niblick
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
JohnBolton
JohnBolton
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.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Dave84311
Dave84311
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.
Dave G.http://www.higstudios.comProjects:Project BU - Fast action pvp MOG
niblick
niblick

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?
niblick
niblick
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.
Agony
Agony
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.)
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas nly, and not for things themselves." - John Locke o
niblick
niblick
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?

Topic Locked

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

Sign in to reply to this topic.