[MDX] Texture.FromBitmap - slow and sometimes gets it wrong.

Started by
1 comment, last by benryves 18 years, 1 month ago
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?

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

Advertisement
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

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Hmm, it seems to be related to debugging; but I get the same abysmal speeds whether I run the debug or release mode (just running the EXE). Thanks, though. I'll stick to my hacky method for the moment, as it's fast enough and small.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

This topic is closed to new replies.

Advertisement