• Advertisement
Sign in to follow this  

[.net] Texture.FromBitmap Problems

This topic is 4891 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Take a look at your caps viewer. Are you exceeding the MaxTextureWidth/MaxTextureHeight caps?

Share this post


Link to post
Share on other sites
My MaxTextureWidth = 2048 and MaxTextureHeight=2048.

If I load textures with TextureLoader.FromFile it works fine.

The problem happens just using Texture.FromBitmap.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement