title: What's a good way to optimise rendering a 2D tile game in XNA?
body: <p>EDIT: I've opted for the second approach as I got 150+ fps even when all 3 tile layers fill the entire screen.</p>
  
  <p>EDIT 2: I read a lot about vertex buffer objects and how they would be great for static geometry and although I still have no idea how to turn my 2D tiles into a VBO and store it on the GPU memory, it definitely seems like the way to go if anyone else is looking for a fast way to render static geometry/quads.</p>
  
  <p>I'm making a game like Super Meat Boy and was wondering if it would be better/faster to store level tiles in an array list and do a camera bounds overlap test to see if it should be rendered.</p>
  
  <pre><code>foreach(Tile tile in world.tiles) {
      if(Overlap(camera.bounds, tile))
          render(tile);
  }
  </code></pre>
  
  <p>Or would a 2D array storing every grid square and only reading off between camera bounds be better?</p>
  
  <pre><code>int left = (int)(camera.position.x - camera.width/2);
  int right = (int)(camera.position.x + camera.width/2) + 1;
  int top = (int)(camera.position.y - camera.height/2); // WHY XNA DO YOU UPSIDE DOWN!!!
  int bottom = (int)(camera.position.y + camera.width/2) + 1;
  for(int x = left; x &lt; right; x++) {
      for(int y = top; y &lt; bottom; y++) {
          render(world.tiles[x][y]);
      }
  }
  </code></pre>
  
  <p>The camera can fit 64*36 tiles on screen which is 2300 odd tiles to read off using the latter approach but is doing an overlap test with every tile in the level any better?  I read an answer about joining matching adjacent tiles into a larger quad and just repeating the texture (although I'm using a texture atlas so I'm not sure how to repeat a region on a texture).</p>
  
  <p>Cheers guys.</p>