title: LibGdx - Batch is not drawing the last .draw command
body: <p>So this is pretty weird...
  I have an abstract BaseScreen. This screen initializes a SpriteBatch on show(). The init() calls the one of the BaseScreen's abstract methods.
  This draw issue is from using the 'gameView' viewport which is an ExtendViewport</p>
  
  <pre><code>SpriteBatch batch;
  @Override
  public void show(){
      batch = new SpriteBatch();
      gameView = new ExtendViewport(SV.V_WIDTH, SV.V_HEIGHT);
      hudView = new ScreenViewport();
      init();
  }
  </code></pre>
  
  <p>This is what I do in the render function:</p>
  
  <pre><code>@Override
  public void render(float delta){
      /* 
          Just in case render is being called more than usual 60 times, 
          I want to call update only 60 times per second. (SV.STEP = 1/60f)
       */
      accum += delta;
      while(accum &gt;= SV.STEP){
          accum -= SV.STEP;
          update();
      }
  
      /* Clear Screen */
      Gdx.gl.glClearColor(0, 0, 0, 1);
      Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);
  
      /* DRAW WORLD */
      batch.setProjectionMatrix(gameView.getCamera().combined);
      gameView.apply(true);
      batch.begin();
      draw(batch, SV.BatchType.World);
      batch.end();
  
      /* DRAW UI
      batch.setProjectionMatrix(hudView.getCamera().combined);
      hudView.apply(true);
      batch.begin();
      draw(batch, SV.BatchType.UI);
      batch.end();*/
  }
  </code></pre>
  
  <p>I have two viewports, one for the game world and one for hud. I use them to set the projection matrix of the batch.</p>
  
  <p>The draw(batch, SV.BatchType.World) command ultimately takes the code to here:</p>
  
  <pre><code>private void drawBody(Batch batch){
      Vector2 position = body.getPosition();
      //Gdx.app.log(TAG, heart.getWidth() + ", " + heart.getHeight());
      batch.draw(heart, position.x-100,position.y-50, h_width*2, h_height*2);
      font.draw(batch, "THIS IS A WOOOOOOOOO!", 100, 100);
  }
  </code></pre>
  
  <p>Now this piece of code draws this:
  <a href="https://i.stack.imgur.com/nxj4A.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nxj4A.jpg" alt="2 Draws"></a></p>
  
  <p>Notice how it doesn't draw the text.</p>
  
  <p>Here's the result with batch.draw only - (font.draw is omitted)
  <a href="https://i.stack.imgur.com/5WH6Y.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5WH6Y.jpg" alt="1 Draw"></a></p>
  
  <p>Now the issue becomes 'what type of .draw was called last' and it ignores all of them - For example:</p>
  
  <pre><code>private void drawBody(Batch batch){
      Vector2 position = body.getPosition();
      //Gdx.app.log(TAG, heart.getWidth() + ", " + heart.getHeight());
      batch.draw(heart, position.x-100,position.y-50, h_width*2, h_height*2);
      font.draw(batch, "THIS IS A WOOOOOOOOO!", 100, 100);
      font.draw(batch, "THIS IS A TEST!", position.x, position.y + 100);
      font.draw(batch, "THIS IS A WOOOOOOOOO!", position.x, position.y - 100);
  }
  </code></pre>
  
  <p>Will draw</p>
  
  <p><a href="https://i.stack.imgur.com/P0k9a.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P0k9a.jpg" alt="3 consecutive fonts"></a></p>
  
  <p>and this</p>
  
  <pre><code>private void drawBody(Batch batch){
      Vector2 position = body.getPosition();
      //Gdx.app.log(TAG, heart.getWidth() + ", " + heart.getHeight());
      batch.draw(heart, position.x-100,position.y-50, h_width*2, h_height*2);
      font.draw(batch, "THIS IS A WOOOOOOOOO!", 100, 100);
      font.draw(batch, "THIS IS A TEST!", position.x, position.y + 100);
      font.draw(batch, "THIS IS A WOOOOOOOOO!", position.x, position.y - 100);
      batch.draw(heart, position.x,position.y, h_width*2, h_height*2);
      batch.draw(heart, position.x,position.y+ 100, h_width*2, h_height*2);
  }
  </code></pre>
  
  <p>Will draw</p>
  
  <p><a href="https://i.stack.imgur.com/Mretj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mretj.jpg" alt="2 batch draw at end"></a></p>
  
  <p>Here is an example with 6 draws, but you have to have a 'throwaway' last .draw</p>
  
  <pre><code>private void drawBody(Batch batch){
      Vector2 position = body.getPosition();
      //Gdx.app.log(TAG, heart.getWidth() + ", " + heart.getHeight());
      batch.draw(heart, position.x-100,position.y-50, h_width*2, h_height*2);
      font.draw(batch, "THIS IS A WOOOOOOOOO!", 100, 100);
      font.draw(batch, "THIS IS A TEST!", position.x, position.y + 100);
      batch.draw(heart, position.x,position.y, h_width*2, h_height*2);
      batch.draw(heart, position.x,position.y+ 100, h_width*2, h_height*2);
      font.draw(batch, "THIS IS A WOOOOOOOOO!", position.x, position.y - 100);
      batch.draw(heart, 10,10, h_width*2, h_height*2);
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/4S8Xn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4S8Xn.jpg" alt="6 draws"></a></p>
  
  <p>Here's one last thing... the last batch draw... if you try to draw it at 0, 0 -> this happens
  <a href="https://i.stack.imgur.com/BfhVY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BfhVY.jpg" alt="position 0 0 draw"></a></p>
  
  <p>Seeking any kind of helpful feedback and/or reason why this may be happening. I'm a newbie with LibGdx and would not shun your feedback on how I decided to use this framework.</p>
  
  <p>Thanks a bunch!</p>