title: Libgdx Orthographic Camera initial position
body: <p>I would like the camera to be positioned correctly but I am getting the result below:</p>
  
  <p><img src="https://i.stack.imgur.com/BhVr8.png" alt="enter image description here"></p>
  
  <p>It seems like when I resize the window, the map does not get rendered properly. Why does that happen?</p>
  
  <p>Code:</p>
  
  <pre><code>public void render(float delta){
      Gdx.gl.glClearColor(0, 0, 0, 1);
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  
      camera.update();
      mapRenderer.setView(camera);
      mapRenderer.render(background);
      mapRenderer.render(foreground);
      shapeRenderer.setProjectionMatrix(camera.combined);
  
      //draw rectangles around walls
      for(MapObject object : tiledMap.getLayers().get("walls").getObjects()){
          if(object instanceof RectangleMapObject) {
              RectangleMapObject rectObject = (RectangleMapObject) object;
              Rectangle rect = rectObject.getRectangle();
              shapeRenderer.begin(ShapeType.Line);
              shapeRenderer.rect(rect.x, rect.y, rect.width, rect.height);
              shapeRenderer.end();
          }
      }
      //done drawing rectangles
  }
  
  @Override
  public void resize(int width, int height) {
      camera.viewportWidth = width;
      camera.viewportHeight = height;
  }
  
  @Override
  public void show(){
      //call the tile map here
      //I believe this is called first before render() is called
      tiledMap = new TmxMapLoader().load("data/mapComplete.tmx");
      mapRenderer = new OrthogonalTiledMapRenderer(tiledMap, 1f);
  
      //initiate shapeRenderer. Can remove later
      shapeRenderer = new ShapeRenderer();
      shapeRenderer.setColor(Color.RED);
  
      camera = new OrthographicCamera();
      camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  }
  </code></pre>