Proper way to use a RenderTarget2D to draw multiple textures?
Posted
by
TheBroodian
on Game Development
See other posts from Game Development
or by TheBroodian
Published on 2012-09-22T00:51:11Z
Indexed on
2012/09/22
3:50 UTC
Read the original article
Hit count: 284
In the process of trying to resolve a split screen issue, I've been trying to use a RenderTarget2D to draw a portion of my scene to a Texture2D, and then again to another Texture2D, but the end result of both Texture2D's is coming out the same. Can anybody tell me what I'm doing wrong?
Texture2D camera1Render;
Texture2D camera2Render;
GraphicsDevice.SetRenderTarget(RenderTarget);
GraphicsDevice.Clear(Color.Transparent);
map.Draw(mapDisplayDevice, Camera1, new Location(0, 0), false);
camera1Render = RenderTarget;
GraphicsDevice.Clear(Color.Transparent);
map.Draw(mapDisplayDevice, Camera2, new Location(0, 0), false);
camera2Render = RenderTarget;
SetRenderTarget(null);
© Game Development or respective owner