I have a SpriteBatch that is set to draw to a RenderTarget2D that is 500 pixels larger in both height and width. Whenever I draw to a point outside of the physical screen dimensions, 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.

  • 9
    Some code, please? – r2d2rigo Aug 14 '11 at 23:06
  • 1
    If you're talking about the CullMode, that is the winding order of the polygons - it's not relevant. – Andrew Russell Aug 15 '11 at 1:40
  • 2
    This question was cross-posted to Stack Overflow: stackoverflow.com/questions/7060033/… – Andrew Russell Aug 15 '11 at 1:41
  • If your world/view/projection transforms put the entire sprite outside of the view frustum, it will get culled no matter what you do. – 3Dave Aug 15 '11 at 4:13
  • Only thing I can think of is the Viewport is not large enough. Its supposed to default to the size of the current RenderTarget2D but check to make sure that it is. – ClassicThunder Nov 28 '11 at 23:34

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.