fehaar / FFWD

This is the FFWD framework for XNA, that allows you to port Unity3D games to XNA for use on WP7 or XBox360 (XBLIG)
Microsoft Public License
133 stars 36 forks source link

Power of two exception #47

Open CodeHelix opened 12 years ago

CodeHelix commented 12 years ago

I am getting exception but am unsure what exactly I will need to do to get rid of the exception. Here is the exception:

System.NullReferenceException was unhandled HResult=-2147467261 Message=Object reference not set to an instance of an object. Source=PressPlay.FFWD StackTrace: at PressPlay.FFWD.Texture.CheckPowerOfTwoSize() in C:\Users\dwc2987@msn.com\FFWD-Templates\FFWD\Framework\PressPlay.FFWD\Texture.cs:line 96 at PressPlay.FFWD.Texture.DoLoadAsset(AssetHelper assetHelper) in C:\Users\dwc2987@msn.com\FFWD-Templates\FFWD\Framework\PressPlay.FFWD\Texture.cs:line 78 at PressPlay.FFWD.Asset.LoadAsset(AssetHelper assetHelper) in C:\Users\dwc2987@msn.com\FFWD-Templates\FFWD\Framework\PressPlay.FFWD\Asset.cs:line 28 at PressPlay.FFWD.Application.LoadSceneAssets() in C:\Users\dwc2987@msn.com\FFWD-Templates\FFWD\Framework\PressPlay.FFWD\Application.cs:line 496 at PressPlay.FFWD.Application.Update(GameTime gameTime) in C:\Users\dwc2987@msn.com\FFWD-Templates\FFWD\Framework\PressPlay.FFWD\Application.cs:line 228 at Microsoft.Xna.Framework.Game.Update(GameTime gameTime) at FFWD.Unity.Tests.Game1.Update(GameTime gameTime) in C:\Users\dwc2987@msn.com\Documents\New folder\XNA\Test\Game1.cs:line 85 at Microsoft.Xna.Framework.Game.Tick() at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e) at Microsoft.Xna.Framework.GameHost.OnIdle() at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame() at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e) at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at Microsoft.Xna.Framework.WindowsGameHost.Run() at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun) at Microsoft.Xna.Framework.Game.Run() at FFWD.Unity.Tests.Program.Main(String[] args) in C:\Users\dwc2987@msn.com\Documents\New folder\XNA\Test\Program.cs:line 15 InnerException:

stanleyjoy commented 12 years ago

The power of two exception happens to a texture that is applied to 3D model. The texture must be

I changed the code so that it will read only 1024x1024 or 512x512 Stan

CodeHelix commented 12 years ago

Thanks. I resized my sprtie sheet and ended up with the same error. So means theres something else causing the exception error besides the sprite sheet.

stanleyjoy commented 12 years ago

If the size of the sprite sheet is around 1024x1024 try hard coding the condition so that it will respond to only that size of texture. I tried this once and it worked for me. stan

stanleyjoy commented 12 years ago

There is also another problem that you could have overlooked. The position of the texture files in your XNA project must be the same way as it is in Unity. You can get this issue. If a "tex" does not have a texture defined. Debug and find out if a texture is present in tex.

fehaar commented 12 years ago

The exception occurs due to a missing null reference check. If there is no texture it fails, so there should be a check for that. I have some new code for it done, but it is mixed up with some other stuff that is not done yet - so it hasn't been posted. Hopefully I can get back to FFWD soon and finish up those parts.