[.net] Texture.FromBitmap Problems
I´m having problems when I try to load a texture from a Bitmap(GDI) using Texture.FromBitmap. If the dimentions is less then 512x512 its working fine, but if it is a little more, throw the message:
"An unhandled exception of type 'Microsoft.DirectX.Direct3D.InvalidCallException' occurred in microsoft.directx.direct3d.dll
Additional information: Error in the application."
My code:
Bitmap bmpTexture = new Bitmap(imagePath+imageName);
textures[imgIndex] = Texture.FromBitmap(device, bmpTexture, 0, Pool.Managed);
Thanks
Take a look at your caps viewer. Are you exceeding the MaxTextureWidth/MaxTextureHeight caps?
My MaxTextureWidth = 2048 and MaxTextureHeight=2048.
If I load textures with TextureLoader.FromFile it works fine.
The problem happens just using Texture.FromBitmap.
If I load textures with TextureLoader.FromFile it works fine.
The problem happens just using Texture.FromBitmap.
Save the bitmap to disk or to a memory stream and try loading the texture from that. If that works it may be good enough, if not it may be a problem with the bitmap itself.
Have you tried using different pools?
Have you tried using different pools?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement