1
我有一個SpriteBatch
設置爲繪製到RenderTarget2D
,它的高度和寬度都是500px。但是,只要我使用物理屏幕寬度/高度以外的點調用SpriteBatch.Draw
方法,它將不會繪製對象。使用XNA繪製屏幕SpriteBatch
我正在對紋理執行一些3D轉換,所以我需要繪製屏幕外的區域。我曾嘗試將設置剔除到None
,這不起作用。
非常感謝您的幫助。
我有一個SpriteBatch
設置爲繪製到RenderTarget2D
,它的高度和寬度都是500px。但是,只要我使用物理屏幕寬度/高度以外的點調用SpriteBatch.Draw
方法,它將不會繪製對象。使用XNA繪製屏幕SpriteBatch
我正在對紋理執行一些3D轉換,所以我需要繪製屏幕外的區域。我曾嘗試將設置剔除到None
,這不起作用。
非常感謝您的幫助。
在修改GraphicsDevice
的Viewport
,然後繪製到您的RenderTarget2D
。
GraphicsDevice.SetRenderTarget(myRenderTarget2D);
GraphicsDevice.Viewport.Width += 500; //or a more sensible calculation
GraphicsDevice.ViewPort.Height += 500;
GraphicsDevice.Clear(Color.Transparent);
//Spritebatch operations
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.graphicsdevice.viewport
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.viewport_members
你有沒有嘗試設置視口相匹配的渲染目標的大小? – Aranda
這個問題被交叉發佈到GDSE:http://gamedev.stackexchange.com/questions/15993/xna-spritebatch-drawing-off-screen –