[.net] Texture.FromBitmap Problems

Started by
3 comments, last by neviton 19 years, 6 months ago
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
Advertisement
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.
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?
Thanx for the help, but now I´m getting another problem here:
When the dimentions of my texture are a little more then 512x512 the textures are blinking, take a look

(http://www.aplicativo.com.br/aplicativo/images/flicker.gif).

This topic is closed to new replies.

Advertisement