1
votes

I have a SpriteBatch that is set to draw to a RenderTarget2D that is 500px larger in both height and width. However, whenever I call the SpriteBatch.Draw method using a point outside of the physical screen width/height it will not draw the object.

I am performing some 3D transforms on the texture so I need the areas outside the screen to be drawn. I have tried setting culling to None and this had no effect.

Thanks ahead of time for your help.

1
Have you tried setting the Viewport to match the render target size?Aranda
This question was cross-posted to GDSE: gamedev.stackexchange.com/questions/15993/…Andrew Russell

1 Answers

0
votes

Modify the Viewport on your GraphicsDevice before drawing to your 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