DirectX 9 Texture Loading Problems

DirectX 9 Texture Loading Problems

Post by Leera » Wed, 10 Aug 2005 13:57:38


I am using DirectX 9 and the D3DX library, and I have some texture
loading problems. Two, to be excact.

Problem #1:
I can't get
D3DXCreateTextureFromResource/D3DXCreateTextureFromResourceEx to work!

Here is how I include the resource:

Ball RT_RCDATA "ball.png"


And here is how I load the texture.

D3DXCreateTextureFromResource(Device, NULL, "Ball", &Ball);


And it just comes out blank.

Problem #2:

How do you load a texture from a different spot in the file. For
instance, say I have one 256x256 picture and I just want to load a
64x64 picture located at (64, 128), how would I do that?
 
 
 

DirectX 9 Texture Loading Problems

Post by Wessam Bah » Wed, 10 Aug 2005 16:53:22


The function seems to fail. What does D3DX say in the debug output?


Create the texture, then use D3DXLoadSurfaceFrom* to specify subrects for
loading...

Wessam Bahnassi
Microsoft DirectX MVP,
Lead Programmer
In|Framez

 
 
 

DirectX 9 Texture Loading Problems

Post by legalize+j » Thu, 11 Aug 2005 01:06:23

[Please do not mail me a copy of your followup]

"Wessam Bahnassi" < XXXX@XXXXX.COM > spake the secret code
< XXXX@XXXXX.COM > thusly:




Also, you might want to use groups.google.com to search archives of
this group; I seem to recall that the resource type must be a
particular type or this won't work.
--
"The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
< http://www.yqcomputer.com/ ~legalize/book/>
Pilgrimage: Utah's annual demoparty
< http://www.yqcomputer.com/ >
 
 
 

DirectX 9 Texture Loading Problems

Post by Wessam Bah » Thu, 11 Aug 2005 18:07:41

"Richard [Microsoft Direct3D MVP]" <legalize+ XXXX@XXXXX.COM > wrote


For this very same reason I prefer to lock the resource myself and pass the
memory pointer to D3DXCreateTextureFromFileInMemory()... At least now I can
support resources no matter of what type they are...

Wessam Bahnassi
Microsoft DirectX MVP,
Lead Programmer
In|Framez
 
 
 

DirectX 9 Texture Loading Problems

Post by ?UTF-8?Q?i » Wed, 11 Jul 2007 16:30:52

The resource type should be RCDATA, and then it will work. So remove the RT_