C# XNA Make rendered screen a texture2d

Posted by redcodefinal on Game Development See other posts from Game Development or by redcodefinal
Published on 2012-11-08T07:31:59Z Indexed on 2012/11/08 11:24 UTC
Read the original article Hit count: 272

Filed under:

I am working on a cool little city generator which makes cities in the isometric perspective. However, a problem arose where if the grid size was over a certain limit it would have awful lag. I found the main problem to be in the draw method. So I took the precautionary step of rendering only items that were onscreen. This fixed the lag but, not by much.

The idea I have is to render the frame once and take a snapshot. Then, display that as a texture2d on screen. This way I don't have to render 1,000,000 objects every frame since they don't change anyways.

TL;DR - I want to

  1. Take a snapshot of an already rendered frame
  2. Turn it into a Texture2D
  3. Render that to the screen instead of all the objects.

Any help appreciated.

© Game Development or respective owner

Related posts about XNA