开发者

How to initialize the GraphicsDevice?

开发者 https://www.devze.com 2023-03-01 08:26 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消