2011-04-29 96 views
0

我想从photoChooser获得一个texture2d。 我得到了photoResult.ChosenPhoto流 我试过使用texture2d.fromStream,但graphicsDevice为null。 我该怎么办? fyi - 我在optionmenuScreen的xna-wp7中做了这个,想在稍后的gamePlayScreen中使用它。 grephicsDevice构造函数初始化非常复杂,所以我认为必须有一个更简单的方法。 请帮忙! 感谢如何初始化GraphicsDevice?

{ 
      if (result.TaskResult == TaskResult.OK) 
      {          
       bmp = new BitmapImage(); 
       bmp.SetSource(result.ChosenPhoto); 
    photoRecieved =Texture2D.FromStream(graphicsDevice, result.ChosenPhoto);     

      }   
     } 

回答

0

您应该能够从位于你的游戏类Graphics类得到它。