Month: September 2009

HTML 5 and the new WEB


Hi,

Basically I just wanna share w/ u a video from Google Developers channel on youtube.
The video explains many concepts that are going to be included in HTML 5.
Basically HTML 5 will have several improvements in the interactivity area by letting letting developers create more rich interactive applications (RIA) without needing to install additional plug ins such as Silverlight or Flash.
The addition of SVG as a new tag brings a great chance for creating more efficient graphics and content.
So here is 😉

Regards,
Herberth

Shaders in Blend


Hi,

I’ve decided to create a project that lets you use Shaders in Microsoft Blend.

http://xhader.codeplex.com/

You can check my first RC Alpha at http://xhader.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33162

I hope soon I’ll be posting some videos with samples

PS: Here my first video sample

http://www.youtube.com/watch/v/bQ23vesp_gY

Regards,
Herberth

Getting started with Silverlight and Pixel Shader


Getting started with Silverlight and Pixel Shader

See an update about my project at http://wp.me/pIsCU-3e

I’ll start this thread about my experience while I’m trying to create an installer for Expression Blend 3 for adding custom (pixel shader) effects.
So let’s get started. First of all we need to write shaders… hm… I’m not really good writing pixel shaders I’ll be using the pixel shaders from http://wpffx.codeplex.com/, unfortunately the last updated is based on the SL3 beta.
If you want I’ll be indicating the updated source code so you can skip all this ‘update comments”. First I’ve download the ‘Mar 25 2009’ release.

Pre requisites:
As far as I remember these products were installed when I started this journey.

  • Visual Studio 2008 SP1
  • Expression Blend 3
  • Silverlight SDK
  • Silverlight Toolkit
  • Shader Effects BuildTask and Template

I think this requires XNA Framework SDK or Direct X SDK, however I’m not quite sure because of I have them already installed.

Getting the Windows Presentation Foundation Pixel Shader Effects Library
The project ‘Windows Presentation Foundation Pixel Shader Effects Library’ (aka WPFFX) is hosted in http://www.codeplex.com at http://wpffx.codeplex.com/. You can download the Changeset #15691 of from http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=wpffx&DownloadId=63200&FileTime=128825198998100000&Build=15691

Here we might run into some troubles so, once you have gotten the WPFFX and try to compile it. If it compiles then go ahead to the next section. If not check the following trouble shouting table:

Issues and  Solutions for WPFFX

Issue: The “ShaderBuildTask.PixelShaderCompile” task could not be loaded from the assembly ShaderBuildTask, Version=1.0.3072.18169, Culture=neutral, PublicKeyToken=44e467d1687af125. Could not load file or assembly ‘ShaderBuildTask, Version=1.0.3072.18169, Culture=neutral, PublicKeyToken=44e467d1687af125’ or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, and that the assembly and all its dependencies are available.

Solution: You will have to install the “Shader Effects BuildTask and Template”. The project other project is in codeplex. You can download an specific build at http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14962 . Please read the readme file about how to install it appropriately. Also you will know how to create projects that uses pixel shaders. For additional information about this build task http://blogs.msdn.com/greg_schechter/archive/2008/08/11/a-visualstudio-buildtask-and-project-and-item-templates-for-writing-shadereffects.aspx

Issue: The type or namespace name ‘Theming’ does not exist in the namespace ‘System.Windows.Controls’ (are you missing an assembly reference?) MainPage.xaml.cs 13 31 SLEffectHarness
You will have to install the “Silverlight Toolkit”. I downloaded http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24246 (July 2009 release). Once It has been installed, you can copy the assemblies to a folder in your solution or use the assemblies in the default installation folder. The important thing here is to update the references.

Issue: The name ‘PixelFormats’ does not exist in the current context MainPage.xaml.cs 57 148

Solution: SLEffectHarness has been affected by breaking changes when moving from Silverlight 2 to Silverlight See:

3.3.19 WriteableBitmap changes

The PixelFormat parameter for the WriteableBitmap constructor has been removed. WriteableBitmap(int pixelWidth, int pixelHeight, PixelFormat format) is now WriteableBitmap(int pixelWidth, int pixelHeight).
The only supported PixelFormat is now Pbgra32.
Similarly, the PixelFormat and PixelFormats type has been removed.
Lock() and Unlock() have been removed.

From http://msdn.microsoft.com/en-us/library/cc645049%28VS.95%29.aspx

Issue: The tag ‘Expander’ does not exist in XML namespace ‘clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls’. MainPage.xaml 225 10 SLEffectHarness
— or –
The tag ‘Viewbox’ does not exist in XML namespace ‘clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls’. MainPage.xaml 314 13 SLEffectHarness
Update the namespace and assembly where the controls are stored.
Add a reference to the dll ‘System.Windows.Controls.Toolkit.dll’.
After xmlns:ctls=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls” Add the following namespace:
xmlns:ctrlsToolkit=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit”
Replace all the ‘ctls:Expander’ with ‘ctrlsToolkit:Expander’
Replace all the ‘ctls:Viewbox’ with ‘ctrlsToolkit:Viewbox’
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load file or assembly ‘System.Web.Silverlight’ or one of its dependencies. The system cannot find the file specified.

Solution:  Remove the Silverlight reference from the properties in your web project. Then remove all the Silverlight pages, and JavaScript’s for Silverlight, and the ClientBin folder too. Then re add the silverlight project by using the silverlight tab in the web project properties. At last set the ‘Start up page’.

Issue: System.Windows.Markup.XamlParseException occurred
Message=”Invalid attribute value SearchMode for property Property. [Line: 5772 Position: 26]”
LineNumber=5772
LinePosition=26
StackTrace:
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at SLEffectHarness.App.InitializeComponent()
at SLEffectHarness.App..ctor()
InnerException:
— OR —
System.Windows.Markup.XamlParseException occurred
Message=”Invalid attribute value controls:Expander for property TargetType. [Line: 6281 Position: 45]”
LineNumber=6281
LinePosition=45
StackTrace:
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at SLEffectHarness.App.InitializeComponent()
at SLEffectHarness.App..ctor()
InnerException:
XamlParserExceptions are thrown because of there are a couple of Xaml syntax outdated.
Remove the setter tag for the ‘SearchMode’ property from the following files:
…\WPFSLFx\WPFSLFx\SL\Demo_silverlight\SLEffectHarness\ShinyBlue.xaml(5772)
…\WPFSLFx\WPFSLFx\SL\Demo_silverlight\SLEffectHarness\System.Windows.Controls.Theming.ShinyRed.xaml(5738)
Update namespace controls:Expander and controls:Viewbox. Remember first we need to add the ‘xmlns:ctrlsToolkit’ namespace, and then we replace the old namespace with this new one. These are the files:
…\WPFSLFx\WPFSLFx\SL\Demo_silverlight\SLEffectHarness\ShinyBlue.xaml(6281)
…\WPFSLFx\WPFSLFx\SL\Demo_silverlight\SLEffectHarness\ShinyBlue.xaml(6286)
…\WPFSLFx\WPFSLFx\SL\Demo_silverlight\SLEffectHarness\System.Windows.Controls.Theming.ShinyRed.xaml(5997)
…\WPFSLFx\WPFSLFx\SL\Demo_silverlight\SLEffectHarness\System.Windows.Controls.Theming.ShinyRed.xaml(6002)
Error: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
at System.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs e)
at System.Windows.FrameworkElement.OnTreeParentUpdated(DependencyObject newParent, Boolean bIsNewParentAlive)
at System.Windows.DependencyObject.UpdateTreeParent(IManagedPeer oldParent, IManagedPeer newParent, Boolean bIsNewParentAlive, Boolean keepReferenceToParent)
at MS.Internal.FrameworkCallbacks.ManagedPeerTreeUpdate(IntPtr oldParentElement, IntPtr parentElement, IntPtr childElement, Byte bIsParentAlive, Byte bKeepReferenceToParent)
Source File: http://localhost:36397/Default.html
Line: 54

Solution: This is a very unusual exception. Unfortunately I haven’t been able to solve it. However I’ve noticed some scenarios that trigger this exception. Make sure you have installed Silverlight Runtime 3.0.40818.0 instead of 3.0.40624.0 The error is very a constant in Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5 (.NET CLR 3.5.30729). Internet explorer and Chrome does not fail after updating Silverlight Runtime. If you run the application in ‘Release’ configuration, this issue shouldn’t appear.

Issue: The “PixelShaderCompile” task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
at ShaderBuildTask.PixelShaderCompile.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) WPFTransitionEffects.csproj 139 5 WPFTransitionEffects

Solution: Unfortunately I don’t why this happens, it’s solved by closing and reopening the visual studio.
At this time the project should compile and you should be able to see the samples running.

Regards,
Herberth