How to initialize the GraphicsDevice?
i am trying to get a texture2d from photoChooser. i got the photoResult.ChosenPhoto stream i tried using texture2d.fromStream but the graphicsDevice is null. what should i do? fyi - i am doing this in xna-wp7 in the optionmenuScreen and want to use it later in the gamePlayScreen. the grephicsDevice constructor is very complicated to initialize so i think there must be a simpler w开发者_C百科ay. please help! thanks
{ if (result.TaskResult == TaskResult.OK) { bmp = new BitmapImage(); bmp.SetSource(result.ChosenPhoto);
photoRecieved =Texture2D.FromStream( graphicsDevice, result.ChosenPhoto);
}
}
You should be able to get it from the Graphics class located in your game class.
精彩评论