Rounding up the series, we are going to look at a couple of my favorite features in Silverlight 5. This one has been a hobby of mine sine my college days (which are a lot further away than I care to admit). Let’s face it, it’s just cool. That, and it’s let some people do some amazing things.
On the eleventh day of Silverlight the team delivered to me… 3D.
Yep, that’s right, we now have a 3D stack in Silverlight. For any of you Xbox developers out there, it should look fairly familiar. The 3D stack in Silverlight is based off of the XNA framework. Call it a XNA lite if you will. While we are not going to build the next blockbuster game, I do think it will be fun to take a look at what 3D looks like inside of Silverlight.
Creating a 3D Applications
If you fire up Visual Studio, you will see two new Silverlight solution types available to you : Silverlight 3D Application and Silverlight 3D Library.
Our example is going to focus on the 3D Application. If you create the new solution you will see that it creates 4 projects for you. Two of them should be familiar to you, a SL project and a Web project. For our 3D application, we have two additional projects (one for the SL side and one for the web). These projects are there to hold your resources for your application. In fact, if you try and add a new item to either project you will notice that you are limited to the following items:
So now that we have a project created, let’s F5 it and see what we get. Isn’t that a nice little error? You probably are looking at a notification that you need to enable GPU acceleration.
Now the fun thing is that when you look at the created web pages, you should see that GPU acceleration is already turned on. So what’s going on? Well it turns out that elevated trust is required to run 3D applications. So turning on elevated trust, whether you are in-browser or out, will get you going. However, you will still need GPU acceleration so don’t turn that off.
Giving the old F5 another try, we see that we have our first 3D application. It even comes complete with a spinning cube.
Going down the rabbit hole of developing 3D applications is beyond the scope of this post, but I did want you to at least get something up and running. Make sure you let me know what cool things you come up with.
Eleven down and one to go. Anyone care to guess what the last post is going be? See you soon.