Texture from Resource



Hi,

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.

PaulPH
.



Relevant Pages

  • Re: copy texture to another texture
    ... I think sharing the resource is viable. ... texture object is still in use? ... A COM object remains "live" as long as someone else holds a reference ... in whatever font is needed for any text area it comes across. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Rendering to Multiple GPUs
    ... related to when or if sharing resources might be permitted. ... > I understand that DirectX doesn't render from system memory. ... even resource management. ... when you create a managed texture, ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: adding a texture resource
    ... > The memory stream issue was discussed lately... ... >> I am trying to add asteroid.bmp as a texture resource and my program just ... >> I also tried changing the Build Action property of the bitmap to Embedded ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: copy texture to another texture
    ... I think sharing the resource is viable. ... texture object is still in use? ... A COM object remains "live" as long as someone else holds a reference ... in whatever font is needed for any text area it comes across. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: copy texture to another texture
    ... I think sharing the resource is viable. ... texture object is still in use? ... A COM object remains "live" as long as someone else holds a reference ... in whatever font is needed for any text area it comes across. ...
    (microsoft.public.win32.programmer.directx.graphics)