Re: Texture from Resource



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

=?Utf-8?B?UGF1bEg=?= <PaulH@xxxxxxxxxxxxxxxxxxxxxxxxx> spake the secret code
<5DF3279E-CC8D-4EE0-9A81-5FE9AA7D6FEE@xxxxxxxxxxxxx> thusly:

I created myself a little problem because I want to load a new texture from
a resource of the same application. So I tried this:
Texture ItemTexture = Texture.FromBitmap(DxDevice,
DxEngine.Properties.Resources.MyTexture, Usage.None, Pool.SystemMemory);
Too bad, the texture was not displayed; the surface of the object showed
just white, as programmed in the material settings. The resource I had
addressed there had been loaded and compiled from file "MyTexture.bmp".

Just to make sure that the source bitmap file and my other code were ok I
replaced the above shown line of code with
Texture ItemTexture = TextureLoader.FromFile(DxDevice, "MyTexture.bmp");
This worked fine, the object was now textured as expected.

Nevertheless, I want to load my textures from resources. Does anybody have
an idea what I am doing wrong? Any hint is more than welcome.

I would have expected the FromBitmap call to work. Did you try running
with unmanaged debugging enabled, with the debug runtime selected, and
seeing if there were any messages in the debug output? Since this is
coming from D3DX, I suspect you won't get any debug D3Dx messages
though.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>

Legalize Adulthood! <http://blogs.xmission.com/legalize/>
.