Texture from Resource
- From: PaulH <PaulH@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 22 Aug 2008 06:03:00 -0700
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.