I'm trying to piece together a bitmap and then make a nondynamic texture from it. I use the static method Texture.FromBitmap() in the Microsoft.DirectX.Direct3D namespace, but I get an IllegalArgumentException regardless of the arguments I feed it. My code looks like this:
The last line throws the exception. I've tried several different Usage enumerations (3rd argument), and three or four PixelFormats for the Bitmap object, but I can't get rid of the exception. The worst part is that the exception doesn't explicitly tell me what's wrong, and neither does MSDN and it's 'preliminary documentation.' Can anybody point me in the right direction please?
Thanks in advance,
Contrast
Code:
Bitmap bitmap = new Bitmap(blockWidth, blockHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
Graphics graphics = Graphics.FromImage(bitmap);
(... draw with graphics object ...)
Texture texture = Texture.FromBitmap(Game.device, bitmap, 0, Pool.Default);
The last line throws the exception. I've tried several different Usage enumerations (3rd argument), and three or four PixelFormats for the Bitmap object, but I can't get rid of the exception. The worst part is that the exception doesn't explicitly tell me what's wrong, and neither does MSDN and it's 'preliminary documentation.' Can anybody point me in the right direction please?
Thanks in advance,
Contrast