5
\$\begingroup\$

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.

\$\endgroup\$
5
  • 9
    \$\begingroup\$ Some code, please? \$\endgroup\$
    – r2d2rigo
    Aug 14, 2011 at 23:06
  • 1
    \$\begingroup\$ If you're talking about the CullMode, that is the winding order of the polygons - it's not relevant. \$\endgroup\$ Aug 15, 2011 at 1:40
  • 2
    \$\begingroup\$ This question was cross-posted to Stack Overflow: stackoverflow.com/questions/7060033/… \$\endgroup\$ Aug 15, 2011 at 1:41
  • \$\begingroup\$ If your world/view/projection transforms put the entire sprite outside of the view frustum, it will get culled no matter what you do. \$\endgroup\$
    – 3Dave
    Aug 15, 2011 at 4:13
  • \$\begingroup\$ 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. \$\endgroup\$ Nov 28, 2011 at 23:34

1 Answer 1

1
\$\begingroup\$

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

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .