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/>
.



Relevant Pages

  • Re: Texture from Resource
    ... a resource of the same application. ... the texture was not displayed; the surface of the object showed ... seeing if there were any messages in the debug output? ... I suspect you won't get any debug D3Dx messages ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: Texture from Resource
    ... a resource of the same application. ... the texture was not displayed; the surface of the object showed ... seeing if there were any messages in the debug output? ... I suspect you won't get any debug D3Dx messages ...
    (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: 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)