5 Nov 2011 18:40
13 Jan 2013 17:31
I decided to update the app from XNA 3.1 to 4.0. As ever this provided an opportunity to tidy up some code and make use of some new features of the updated framework, however there were several things that required changing.
- The current starfield shader makes use of Point Sprites, which are no longer available in version 4 (see Shawn Hargreave's post on Point sprites in XNA Game Studio 4.0). I've switched to a set of 4 indexed vertices per star.
- Removed VertexDeclation code
- Updated VertexBuffer and IndexBuffer constructors, and code to set VertexBuffers.
- Replaced effect.Begin(), effect.CurentTechnique.Passes[...].Begin() and .End() with effect.CurentTechnique.Passes[...].Apply()
- Reduced GPU buffer sizes, e.g. switching VertexPositionColor structures to a custom VertexPosition structure (since color information was being set using a shader parameter), and using packed vector classes such as Short2 where appropriate.
- The new dynamic audio features of XNA 4.0 gave me an opportunity to synthesise the sound effects for which I previously had to find appropriate source files.
- Added support for the new multi-touch APIs targetting Surface 2.0, which are based on .NET 4.