[MDX] Texture.FromBitmap - slow and sometimes gets it wrong.
I decided to have a look into Managed DirectX, and so far it's been pretty plain sailing.
One issue I've been having is the Texture.FromBitmap() method. It's taking up to a minute per Bitmap; I'm passing Usage.None and Pool.Managed as parameters. Other combinations tend to fail.
Not only is it incredibly slow, but some textures appear to only decode the top row (so the final result is that the wall is made up of lots of vertical stripes, one per pixel column on the original image).
My workaround is to create a new MemoryStream, to use the Bitmap.Save() method to save it to the stream, to reset the position in the stream with Stream.Seek then to use the TextureLoader.FromStream() method to load it again. This takes under a second to load all the textures (DOOM is hardly a resource hog) but it seems a little... hacky.
I'm using the Bitmap class as it seemed the best generic class to store bitmap data in in my DOOM.Wad class.
Being an (almost) complete DirectX beginner, I doubt I've given anywhere near enough information; judging by other posts on other websites it seems to be more linked to the slowness of the Bitmap class. Is this the case? Is there a better, cleaner way to load a Texture from a Bitmap?
I don't have an answer as such, but the thread title rung a few bells [wink]
MSDN Forums: Performance problem with Texture.FromBitmap ... leading to..
GDNet: Slow debugging in VS2005 (C#)
Only had a scan read of both, but looks like they might contain some useful info.
hth
Jack
MSDN Forums: Performance problem with Texture.FromBitmap ... leading to..
GDNet: Slow debugging in VS2005 (C#)
Only had a scan read of both, but looks like they might contain some useful info.
hth
Jack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement