multiple viewports

Aug 12, 2012 at 3:30 PM

First of all: Congrats on this solution!

It is quite robust, and easy to implement. The first XNA integration in WPF which formed no problems for an non-expert in WPF!

Quick question:
If i want multiple render windows, do I make multiple "game" classes, and let them render the same data? Or is this a performance hell, and a better solution?

Greetings!
Dreezn

Coordinator
Aug 15, 2012 at 6:00 PM

Multiple renders can be achieved two ways, but you'll have to be careful.

Before any of the solutions, here's the caveat: there is one and only one GraphicsDevice instantiated for the entire XNAML library. This makes it so nothing breaks when rendering multiple windows. The presents a scaling issue where if one window is gigantic and the others are significantly smaller, fine-tuned items (text, etc.) will not show up well.

For the solutions...

1. Make Multiple Game Classes. You can share the data as much as you want and, because there's only one graphics device, this might actually make the most sense for you.

2. Make a single game class and render it in the spots you want using the regular XNA viewporting (http://msdn.microsoft.com/en-us/library/bb313965(v=xnagamestudio.40).aspx)

Those are really your only two options. Having 2 game classes, however, means that there will be more updates and renders firing on one or more threads. This could lead to extra performance problems if you're doing anything cpu-intensive.