Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
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. –  David Lively 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
add comment

1 Answer

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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