I'm really confused, and rather frustrated atm.
I'm trying to get minimaps rendered dynamically for my MMORPG (to ditch dependence on prerendered minimaps, etc). Since C# doesn't let you do anything raw, I figured I would just create a directX texture every frame (the texture is like 30x30, so it should be small enough to not matter).
Since I cannot plot to the DirectX texture, I plotted to a Bitmap object, and than converted it into a DirectX texture on every frame.
My problem is, I don't really know how to do this. I could convert the Bitmap to a Stream and use the DirectX TextureLoader.FromStream() function, or the Texture = new Texture(Device,Bitmap,Usage,Pool). But the later of the two seems to be INCREDIBLY slow!
Texture TheTexture = new Texture(MyDirectX.MyDevice, MyMinimap,
Usage.None, Pool.Managed);
I found it was 14x faster to load a 512x512 bitmap (from my Assembly().Reflection) as a stream from the TextureLoader class in DirectX.
What should I do? Does anyone know how to convert a Bitmap to a stream, or how to get the new Texture() command to work properly?
Edit: Jeeze, even this doesn't work; it throws an illegal operation error when the TextureLoader reads it.
Stream TheStream = new MemoryStream();
MyMinimap.Save(TheStream, ImageFormat.Png);
Texture TheTexture = TextureLoader.FromStream(MyDirectX.MyDevice, TheStream);
[Edited by - Thevenin on November 7, 2006 4:49:23 PM]