C# MDX RenderToSurface, where to reset after device is lost?

Posted by Moritz Schöfl on Stack Overflow See other posts from Stack Overflow or by Moritz Schöfl
Published on 2011-02-25T15:23:08Z Indexed on 2011/02/25 15:25 UTC
Read the original article Hit count: 335

Filed under:
|

Hi,

I got a problem with the RenderToSurface class.

When I resize the Form of my Device, the Draw method is still called, but doesnt throw an Exception, it looks like this: device.Clear(ClearFlags.Target, Color.Red, 0, 0); device.BeginScene(); // here is out commented code device.EndScene(); device.Present();

In another method, I wrote this: renderToSurface.BeginScene(surfaces[currentIndex]); // here is out commented code renderToSurface.EndScene(Filter.None);

and this method seems to throw a nullpointer exception when I resize the window;

So my question is: - where to reset / restore / handle the renderToSurface class?

(i tried it with the DeviceReset event like following -> void OnDeviceReset(object sender, EventArgs e) { renderToSurface = new RenderToSurface(Game.Device, Game.ClientSize.Width, Game.ClientSize.Height, Format.A8R8G8B8, true, DepthFormat.D16); } )

© Stack Overflow or respective owner

Related posts about c#

Related posts about mdx