Charles Petzold on writing books, reading books, and exercising the internal UTM

Recent Entries
< PreviousBrowse the ArchivesNext >
Subscribe to the RSS Feed

XNA 3D on the Zune HD?

May 4, 2010
New York, N.Y.

Last Wednesday, I gave a lunchtime presentation about Windows Phone 7 programming at Devscovery 2010 NYC, and among the little demos was a simple 3D cube coded in XNA that rotates around the X, Y, and Z axes in a confusing manner. Here it is running on the on-screen phone emulator:

I've now adapted the source code to the April CTP of the Windows Phone 7 tools. (One of the changes from the March to April CTP was the switch in default XNA orientation from portrait to landscape, but landscape doesn't work by default without "manually" setting the back buffer.)

I guess the presentation was a little disappointing because I don't actually have a Windows Phone 7 device yet. Towards the end, however, I tried to fool my audience into thinking they were going to be getting a rare and authorized glimpse of one of the Windows Phone 7 prototypes:

Apparently nobody believed me that this was an actual Windows Phone 7 device, even though the screen displayed the same animated cube that was just running on the emulator. In fact, the animation was better on this phone than in the emulator, which was suffering by running on a laptop with an inadequate GPU.

The secret behind this magic trick is a Zune HD embedded in an eviserated phone. Amazingly, the Zune screen was just a little smaller than the area previously occupied by the dialing pad, so the fit was just about perfect.

The other half of this magic trick required some gonzo programming: Although the Zune HD runs XNA 2D programs, it doesn't support XNA 3D. I had to simulate a rotating 3D cube with a bunch of transforms and re-ordering the six sides of the cube so the foreground sides always clip the background sides. Here's the source code for that little exercise, requiring Visual Studio 2008 with XNA Game Studio 3.1 and the Zune Extensions installed.


YouTube video?

— Eric Maffei, Tue, 4 May 2010 19:54:02 -0400

I kinda like the idea that either you're there and you see it, or you're not and you don't. — Charles

Recent Entries
< PreviousBrowse the ArchivesNext >
Subscribe to the RSS Feed

(c) Copyright Charles Petzold