title: Coordinate (0, 0) is 1 pixel off with LibGDX Camera/Viewport
body: <p>Hopefully the title isn't too confusing, but I am new to LibGDX and after hours of searching on Google I finally got the camera and viewport to work, it now properly scales to the screen. There's still one problem, while the Y coordinate at 0 is correct, the X coordinate at 0 seems to be 1/a few pixels off, I am bad at describing, so here's a picture: <a href="http://i.imgur.com/Np3nOxn.png" rel="nofollow">Link to image</a></p>
  
  <p>Like I said, I'm new to LibGDX and I am guessing it's a pretty obvious mistake, but here's the code I'm using:</p>
  
  <p>I use these variables:</p>
  
  <pre><code>public static final int WORLD_WIDTH = 480;
  public static final int WORLD_HEIGHT = 800;
  OrthographicCamera cam;
  Viewport viewport;
  SpriteBatch batch;
  Texture img;
  </code></pre>
  
  <p>I have this in the create():</p>
  
  <pre><code>cam = new OrthographicCamera(WORLD_WIDTH, WORLD_HEIGHT);
  cam.setToOrtho(false, WORLD_WIDTH, WORLD_HEIGHT);
  viewport = new FitViewport(WORLD_WIDTH, WORLD_HEIGHT);
  img = new Texture("badlogic.jpg");
  </code></pre>
  
  <p>I have this in the render(): </p>
  
  <pre><code>batch.setProjectionMatrix(cam.combined); //Important
  </code></pre>
  
  <p>And further down in render() I have this code:</p>
  
  <pre><code>batch.begin();
  batch.draw(img, 0, 0);
  batch.end();
  </code></pre>
  
  <p>And I have this in resize():</p>
  
  <pre><code>viewport.update(width, height);
  </code></pre>
  
  <p>Which gives the result from the picture.</p>
  
  <p>Is there a solution to this problem, do I need to alter a part of the code, add some new lines or is there a smarter way to do a camera/viewport?</p>
  
  <p>I'm looking forward to your answers, thanks in advance.</p>
  
  <p>Cheers!</p>