title: How can I draw text using Libgdx/Java?
body: <p>I've been having a lot of trouble Googling how to draw simple 2D text with Libgdx. Here is the code that I've put together so far:</p>
  
  <pre><code>SpriteBatch spriteBatch;
  BitmapFont font;
  CharSequence str = "Hello World!";
  spriteBatch = new SpriteBatch();
  font = new BitmapFont();
  
  spriteBatch.begin();
  font.draw(spriteBatch, str, 10, 10);
  spriteBatch.end();
  </code></pre>
  
  <p>The code does draw the Hello World string, however, it messes up all my other drawings. They are there, only brutally mutilated, and move and all that. I've tried <code>Gdx.gl11.glPushMatrix()</code> and <code>Gdx.gl11.glPopMatrix()</code> around just about every subset of statements. </p>
  
  <p>I've narrowed the mutilated drawings down to the <code>font.draw()</code> call, if that's taken out, everything works fine (but of course there is no text then).</p>