Ich programmier jetzt schon ne weile mit Texturen, Directx, Sprites... , aber ein Problem hab ich immer noch wenn ich die Fenstergröße ändere passt sich die Device zwar an aber beim nächsten draw2d einer Texture kommt sofort ne NullReferenceExeption:
Spoiler anzeigen
Es funktioniert dann erst wieder wenn ich alles Texturen neu lade, aber das kostet Zeit und Speicher. Gibt es nicht noch irgendwie eine andere Methode Texturen an ihre Device "neu anzupassen"?
System.NullReferenceException wurde nicht behandelt.
Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Source=Microsoft.DirectX.Direct3DX
StackTrace:
bei Microsoft.DirectX.Direct3D.D3DX.GetUnmanagedTexture(Texture tex)
bei Microsoft.DirectX.Direct3D.Sprite.Draw2D(Texture srcTexture, Rectangle* srcRectangle, SizeF* destinationSize, PointF* center, Single rotationAngle, PointF position, Int32 color)
bei Microsoft.DirectX.Direct3D.Sprite.Draw2D(Texture srcTexture, Rectangle srcRectangle, SizeF destinationSize, PointF rotationCenter, Single rotationAngle, PointF position, Int32 color)
bei Microsoft.DirectX.Direct3D.Sprite.Draw2D(Texture srcTexture, Rectangle srcRectangle, SizeF destinationSize, PointF position, Color color)
bei Tiles.Form1.paintevent() in C:\Users\Dominik\Documents\Visual Studio 2010\Projects\Tiles\Tiles\Form1.vb:Zeile 134.
bei Tiles.Form1.Timer1_Tick(Object sender, EventArgs e) in C:\Users\Dominik\Documents\Visual Studio 2010\Projects\Tiles\Tiles\Form1.vb:Zeile 2126.
bei System.Windows.Forms.Timer.OnTick(EventArgs e)
bei System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.Run(ApplicationContext context)
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
bei Tiles.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 81.
bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:
Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Source=Microsoft.DirectX.Direct3DX
StackTrace:
bei Microsoft.DirectX.Direct3D.D3DX.GetUnmanagedTexture(Texture tex)
bei Microsoft.DirectX.Direct3D.Sprite.Draw2D(Texture srcTexture, Rectangle* srcRectangle, SizeF* destinationSize, PointF* center, Single rotationAngle, PointF position, Int32 color)
bei Microsoft.DirectX.Direct3D.Sprite.Draw2D(Texture srcTexture, Rectangle srcRectangle, SizeF destinationSize, PointF rotationCenter, Single rotationAngle, PointF position, Int32 color)
bei Microsoft.DirectX.Direct3D.Sprite.Draw2D(Texture srcTexture, Rectangle srcRectangle, SizeF destinationSize, PointF position, Color color)
bei Tiles.Form1.paintevent() in C:\Users\Dominik\Documents\Visual Studio 2010\Projects\Tiles\Tiles\Form1.vb:Zeile 134.
bei Tiles.Form1.Timer1_Tick(Object sender, EventArgs e) in C:\Users\Dominik\Documents\Visual Studio 2010\Projects\Tiles\Tiles\Form1.vb:Zeile 2126.
bei System.Windows.Forms.Timer.OnTick(EventArgs e)
bei System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.Run(ApplicationContext context)
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
bei Tiles.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 81.
bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:
Es funktioniert dann erst wieder wenn ich alles Texturen neu lade, aber das kostet Zeit und Speicher. Gibt es nicht noch irgendwie eine andere Methode Texturen an ihre Device "neu anzupassen"?