Bringing your XNA WinForms Controls to MonoGame + OpenGL

If you’ve been embedding XNA into your WinForms-based applications for games or editors, you probably built your solution off of the WinForms Series 1: Graphics Device code sample on MSDN.  This solution implemented a GraphicsDeviceControl that could essentially embed the underlying DirectX buffer into a Panel, and a new GraphicsDeviceService implementation to manage one or more instances of your controls.

A modified version of the WinForms Series demo using two SpinningTriangleControls.

A modified version of the WinForms Series demo using two SpinningTriangleControls.

If you’ve tried porting your entire stack to MonoGame, you likely discovered that the several parts of the GraphicsDevice API entries that the WinForms Series implementation depended on are not implemented.  The missing entries are specific overloads of the GraphicsDevice constructor, GrpahicsDevice.Present, and GraphicsDevice.Reset.  At this time of writing, these entries are still not implemented.  I’m not sure if it would be possible to port GraphicsDeviceControl to MonoGame’s SharpDX backend without them, but it turns out that we don’t need them if we use the OpenTK backend instead.  Given that OpenTK will make your applications friendlier to port across to other systems, I’d say it’s the better choice anyway.

Continue reading

Posted in Tutorials | Tagged , , | 25 Comments

Out of the Water

Every once in a while I’ll think of something and say to myself “that would be interesting to talk about”, but I’ve never bothered to set up the infrastructure.  Clearly, I’ve finally done something about that.

I spend a lot of time doing software development  Outside of my day job, most of that development is devoted to games and game-related things, like tooling and support libraries.  This blog will mainly be devoted to those topics.  You might be able to expect topics on C# and .NET, XNA, MonoGame, Unity, past games and current game development, or just stuff related to games in general.

Posted in Uncategorized | 2 Comments