title: How to draw a line using libgdx?
body: <p>I am trying to draw some lines for debugging using libgdx but I failed. this is my code</p>
  
  <pre class="lang-java prettyprint-override"><code>public class MainMenu extends Screen implements InputProcessor {
  
  private OrthographicCamera camera;
  SpriteBatch myBatch;
  ShapeRenderer shapeDebugger;
  
  public MainMenu(Game game) {
      super(game);
      camera= new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      camera.update();}
  
  @Override
  public void render(float delta) {
      Gdx.gl.glClearColor(0, 0, 0, 1);
      Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
  
      myBatch.begin();
      stage.draw();
      Gdx.gl10.glLineWidth(10);
      shapeDebugger.setProjectionMatrix(camera.combined);
      shapeDebugger.begin(ShapeType.Line);
      shapeDebugger.setColor(1, 1, 1, 1);
      shapeDebugger.line(2, 2, 5, 5);
      myBatch.end();
      }
  }
  </code></pre>
  
  <p>I get an error from line</p>
  
  <p><strong>shapeDebugger.setProjectionMatrix(camera.combined);</strong></p>
  
  <p>@Pranav008 </p>
  
  <p>thank you very much. I didn't expect that I need to initiate it. but I've got a true problem. I draw the line to center of the game screen like this.</p>
  
  <pre><code>    Gdx.gl10.glLineWidth(2);
      shapeDebugger.setProjectionMatrix(camera.combined);
      shapeDebugger.begin(ShapeType.Line);
      shapeDebugger.setColor(1, 1, 1, 1);
      shapeDebugger.line(Gdx.graphics.getWidth()/2, 0,Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight());
      shapeDebugger.end();
  </code></pre>
  
  <p>when I try to resize the screen it doesn't update the to center it goes far away to right.</p>