簡體   English   中英

無法在XNA上顯示高分辨率圖像

[英]Unable to display High-res images on XNA

我正在使用XNA框架在Kinect上創建一個應用程序。 它會產生問題,當我添加高分辨率圖像時,它僅在屏幕上顯示一半的圖像,而如果是極高分辨率的圖像則僅顯示圖像的25%,但是如果我上傳360X480尺寸的圖像,它將為我提供完整的圖像。

我正在46英寸電視上全屏運行該應用程序。

請告訴我,如果我上傳的圖像分辨率超過360X480,為什么它不能顯示完整的圖像。

        public Game1()
         {
             graphics = new GraphicsDeviceManager(this);


             graphics.PreferredBackBufferHeight = 1280;
             graphics.PreferredBackBufferWidth = 720;

             graphics.IsFullScreen = true;

編輯

我正在使用以下代碼加載和繪制圖像。

defaultShirt= Content.Load<Texture2D>("kurta6");

   currentShirt = defaultShirt;    

  spriteBatch.Draw(currentShirt, new Rectangle
  (shirtXposition + x + 90, shirtYposition +   y + 50, customShirtHeight + 160, 
  customShirtWidth + 140), 
  new Rectangle(0, 0, 480, 360), 
  Color.White, 0, origin, SpriteEffects.None, 1);

我還使用以下方法從數據庫添加圖像。

        if (_image1Path[i] != "")
        {
            using (System.IO.FileStream stream = new System.IO.FileStream("D:/xampp/htdocs/boutique_cms/" + _image1Path[i], System.IO.FileMode.Open))
            {
                _image1Display[i] = Texture2D.FromStream(GraphicsDevice, stream);

                currentImagePath = _image1Display[i];
            }
        }

謝謝

如上所述,您將矩形切為矩形(0,0,480,360),您需要執行的操作。

這將繪制圖像並將其縮放以適合下面指定的區域。

   spriteBatch.Draw(currentShirt, new Rectangle
       (shirtXposition + x + 90, shirtYposition + y + 50, customShirtHeight + 160,
       customShirtWidth + 140), Color.White);

您正在使用rectangle(0,0,480,360)切割圖像。 所以您實際上說要從vector2d(0,0)vector2d(480,360)拍攝一張圖像,而不是像這樣嘗試:

 spriteBatch.Draw(texture, new vector2d(x,y), color);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM