Dynamically loading a mesh

Aug 24, 2010 at 9:51 AM

Hi,

I'm trying to load a Mesh dynamycally with XamlReader , but without any success.

   string xamltxt;
         private void EjecutarStringXaml()
         {
                  xamltxt = " xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" ";
                  xamltxt += "  xmlns:execution=\"clr-namespace:Balder.Execution;assembly=Balder\" ";
                  xamltxt += " xmlns:geometries=\"clr-namespace:Balder.Objects.Geometries;assembly=Balder\"  ";   
             //xamltxt += "<execution:Game Width=\"800\" Height=\"600\"> ";
             xamltxt += " <geometries:Mesh AssetName=\"/SLARToolKitBeginnersGuide;component/data/Assets/Car.ase\" />";
            // xamltxt += "      </execution:Game>";
             
    
             this.Game.Children.Add(System.Windows.Markup.XamlReader.Load(xamltxt) as Mesh);

             lock (this.Game.Scene.RenderableNodes)
             {
                 this.ActiveMesh = System.Windows.Markup.XamlReader.Load(xamltxt) as Mesh;
                 this.Game.Scene.RenderableNodes.Clear();
                 this.Game.Scene.AddNode(ActiveMesh);
             }
             
        }

Error :"carácter xml no válido [Line: 1 Position: 2]"
On the MainPage.xaml is defined "<execution: Game"


Please help..

Coordinator
Aug 25, 2010 at 11:31 AM

Don't think that will work. 

Is it important that you do it with Xaml like that? 

You could go and load Mesh the programmatically and just add it.

Sep 8, 2010 at 8:58 PM
Edited Sep 8, 2010 at 9:03 PM

I am sorry for replying very late.

You were right, I solved my problem easily, loading the mesh programatically