Sign in to follow this  
slynk

XNA Draw to Texture2D?

Recommended Posts

I have code where I draw some paths over a tile. I use triangle strips to accomplish it. I'm wanting to make a rotation animation by just rotating the texture. But to draw the paths during rotation I'd have to calculate the curves and convert them to triangle strips every update till the animation is over.

SO, I'm wondering, can I draw the triangle strips directly onto the texture? Then, after rotation. I replace it with a blank tile and draw the updated paths over it.

EDIT: Actually, if I can draw the path to the texture, I wouldn't even need to recalculate the curve.

Share this post


Link to post
Share on other sites
[quote name='slynk' timestamp='1298498588' post='4778156']
I have code where I draw some paths over a tile. I use triangle strips to accomplish it. I'm wanting to make a rotation animation by just rotating the texture. But to draw the paths during rotation I'd have to calculate the curves and convert them to triangle strips every update till the animation is over.

SO, I'm wondering, can I draw the triangle strips directly onto the texture? Then, after rotation. I replace it with a blank tile and draw the updated paths over it.

EDIT: Actually, if I can draw the path to the texture, I wouldn't even need to recalculate the curve.
[/quote]
You should look into RenderTarget2D and GraphicsDevice.SetRenderTarget(), which allows you to draw to a target other than the screen. I don't know of any XNA 4.0 tutorials for using these off-hand - be aware that they are one of the things which have changed slightly since version 3.1.


Share this post


Link to post
Share on other sites
[quote name='WavyVirus' timestamp='1298502225' post='4778182']You should look into RenderTarget2D and GraphicsDevice.SetRenderTarget(), which allows you to draw to a target other than the screen. I don't know of any XNA 4.0 tutorials for using these off-hand - be aware that they are one of the things which have changed slightly since version 3.1.[/quote]

Hmm, I'll look into and post results here. Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this