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);
}
)