Hi there!
I noticed (not only with Nuclex XNA games, but with all/most XNA demos that do more than just draw an untextured triangle) that XNA or our implementations have a severe problem with multiple monitors. Just try this: run an XNA game on your PC on your main screen, in a window. Then drag it all the way over to your second monitor (assuming you have one ;-).
For some reason, XNA is incorrectly releasing content and crashes.
In my own code, I've been trying to get around this, but with no success. Anyone has got a clue where the problem lies?
I'm starting to believe (completely unbased however) that it's not us that call the XNA framework somehow incorrectly, but that the problem lies withing XNA itself.
It's a really nasty problem, because it means that our XNA experiments have a weak crashy point.
In games, this is not such a big problem, but once you start developing tools with XNA, you can't expect the user to never move a window to another monitor, no?
anyone who has noticed this problem too, or knows a genius solution to it?
kind regards,
loki
I had this issue and got
I had this issue and got around it like this.
Wired two events to the main game object like this:
Window.ClientSizeChanged += new EventHandler(Resize);
Window.ScreenDeviceNameChanged += new EventHandler(DeviceChanged);
And wrote these methods to go with them:
public void Resize(object sender, EventArgs e)
{
Camera.myViewport.Width = Window.ClientBounds.Width;
Camera.myViewport.Height = Window.ClientBounds.Height;
}
void DeviceChanged(object sender, EventArgs e)
{
Camera.myViewport = graphics.GraphicsDevice.Viewport;
Camera.myViewport.MinDepth = .5f;
Camera.myViewport.MaxDepth = 1000f;
}
Hope this helps.
http://randomchaosuk.blogspot.com/
Didn't have any issues...
I'm using a multi-mon system at home and, just to see whether performance degrades, I dragged my XNA windows onto the secondary screen on several occassions. I didn't have any crashes at all, XNA silently created a new
GraphicsDeviceand theGraphicsDeviceManagerdid the usualUnloadGraphicsContent(true)andLoadGraphicsContent(true)cycle.Are you by any chance using RenderTargets, dynamic vertex/index buffers or some other resource that requires manual resource management? That would be my first guess, because, as soon as you forget just a single manually managed resource, the GraphicsDevice cannot be reset anymore and when a new GraphicsDevice is created, just accessing that resource will cause an Exception.
In my case..
The issue was happening because the viewport my camera was using gets destroyed and so my wired events reset my cameras view port. At least that's my best guess as to why I got the issue. :)
http://randomchaosuk.blogspot.com/
Post new comment