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 –