Page view counter

Silverlight Tips of the Day - Blog by Mike Snow

Game Programming with Silverlight

April 2009 - Posts

Silverlight Tip of the Day #107 – Animation Easing Demo

This tip has been migrated to:

http://www.michaelsnow.com/2010/05/18/silverlight-tip-of-the-day-21-animation-easing-2/

Silverlight Tip of the Day #106 – Setting Default Browser from within VS
This blog has been migrated to the new blog location: http://www.michaelsnow.com/2010/05/06/silverlight-tip-of-the-day-15-setting-default-browse-in-visual-studio/
Posted: Apr 06 2009, 02:21 PM by mike.snow | with 6 comment(s) |
Filed under:
Silverlight Tip of the Day #105 – How to Enable GPU Acceleration

With the release of Silverlight 3 Beta 1 GPU (Graphics Processing Unit) acceleration (or hardware acceleration) is now available. The GPU is a processor attached to your graphics card that is generally used for calculating floating point operations. In addition, it contains a number of graphics primitives that when used will save you a lot of CPU time.

By default this option is disabled and to use it you must enable it both on your Silverlight control/plug-in as well as any of the controls you want to leverage it.

To enable it on your Silverlight control open your web page that hosts the Silverlight control.

For HTML modify the Silverlight control to include the following param:

<param name="EnableGPUAcceleration" value="true" />

For ASPX add the following attribute:

<asp:Silverlight ID="Silverlight1" EnableGPUAcceleration="true" runat="server" Source="~/ClientBin/MyApp.xap" MinimumVersion="3.0.40307.0" Width="100%" Height="100%" />

Now, to apply it to a control you will need to add CacheMode="BitmapCache” to the control. The following example shows you how to add it to an Image control:

<Image CacheMode="BitmapCache" Source="MyImage.png"></Image>

Currently BitmapCache is the only option. What this does is it causes visual elements (and all their children) to be cached as bitmaps after they have already been rendered. Once cached, your application can bypass the expensive rendering phase for the cached elements and just display them.

If you want to test out what is being cached in your application add the following attribute to your Silverlight control:

<asp:Silverlight EnableCacheVisualization="true" ID="Silverlight1" EnableGPUAcceleration="true" runat="server" Source="~/ClientBin/MyAPp.xap" MinimumVersion="3.0.40307.0" Width="100%" Height="100%" />

Uncached objects will appear tinted where as cached objects will not be tinted.

This feature is supported on:

  1. Windows: Both full screen and non-full screen
  2. Mac: Full screen only.

This feature should be used when the following are occurring to your control:

  1. Transformations (translating, rotating, stretching, etc.).
  2. Clipping.
  3. Blending.

 

Thank you,
--Mike Snow

 Subscribe in a reader 
Silverlight Tip of the Day #104 – Cool Silverlight Tutorial Blogs

Of the course of the last year I have been collecting links to some really good Silverlight tutorial blogs that I thought I would share with you. These are active blogs, frequently updated, that are specifically oriented to teaching Silverlight development. That is, they are all about showing you how things are done and giving you the source code you need to do it yourself. If I have missed any good links post a comment and I will add it!

Silverlight tutorial sites in alphabetical order:

Author/Site Link
Andy Beauliue http://www.andybeaulieu.com/Home/tabid/67/Default.aspx
Brad Adams http://blogs.msdn.com/brada/default.aspx
Chris Hay http://www.screencast.com/users/chrishayuk
DotNet Curry http://www.dotnetcurry.com/
Jesse Liberty http://silverlight.net/blogs/jesseliberty/
Joe Stegman http://blogs.msdn.com/jstegman/default.aspx
Nikola Mihaylov http://blogs.msdn.com/nikola/default.aspx
Page Brooks http://pagebrooks.com/
Pete Brown http://community.irritatedvowel.com/blogs/pete_browns_blog/default.aspx
Shawn Wildermuth http://wildermuth.com/
Silverlight Learning Resources http://silverlight.net/learn/
SilverlightShow http://www.silverlightshow.net/
Terence Tsang http://www.shinedraw.com/
Tim Heuer http://timheuer.com/blog/
Timmy Kokke http://geekswithblogs.net/tkokke/Default.aspx

Also, here is a great Silverlight Blog summary page: http://www.netvibes.com/rboarman#Silverlight

Thank you,
--Mike