title: libGDX - Drawing Texture via SpriteBatch Result Flip
body: <p>When I tried draw a <code>Texture</code> using <code>SpriteBatch</code> it was result flip like this:</p>
  
  <p><img src="https://i.stack.imgur.com/aMu9b.jpg" alt="Drawing Texture using SpriteBatch result Flip"></p>
  
  <p>Here what I do:
  I create <code>MyRect</code> object which draw bounding rectangle and an image.</p>
  
  <p>Here <code>MyRect</code> class preview:</p>
  
  <pre><code>public class MyRect {
  private Vector2 position;
  private int width;
  private float height;
  
  private Texture img;
  private Sprite sprite;
  
  public MyRect(int x, int y, int width, int height){
      img = new Texture("badlogic.jpg");
      sprite = new Sprite(img);
  
      position = new Vector2(x,y);
      this.width = width;
      this.height = height;
  }
  
  public void draw(ShapeRenderer shapeRenderer, SpriteBatch batch){
      // Gdx.gl.glClearColor(0, 0, 0, 1);
      // Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
      shapeRenderer.begin(ShapeType.Line);
  
      // Draw Background color
      shapeRenderer.setColor(55 / 255.0f, 80 / 255.0f, 100 / 255.0f, 1);
      shapeRenderer.rect(position.x, position.y, width, height);
  
      shapeRenderer.end();
  
      batch.begin();
      // batch.disableBlending();
      batch.draw(img, position.x, position.y, 
              width, height);
      batch.end();
  }
  }
  </code></pre>
  
  <p>Parameters <code>ShapeRenderer</code> and <code>SpriteBatch</code> pass by <code>GameScreen</code> class.</p>
  
  <p><code>GameScreen</code> preview:</p>
  
  <pre><code>public class GameScreen implements Screen{
  private MyRect myRect;
  private ShapeRenderer shapeRenderer;
  private SpriteBatch batch;
  private OrthographicCamera cam;
  
  public GameScreen(){
      myRect = new MyRect(10,10,50,50);
  
      int gameHeight=100;
      cam = new OrthographicCamera();
      cam.setToOrtho(true, 136, gameHeight);
  
      batch = new SpriteBatch();
      batch.setProjectionMatrix(cam.combined);
  
      shapeRenderer = new ShapeRenderer();
      shapeRenderer.setProjectionMatrix(cam.combined);
  }
  
  @Override
  public void render(float delta) {
      // TODO Auto-generated method stub
      myRect.draw(shapeRenderer, batch);
  }
  }
  </code></pre>
  
  <p>Why is this happen? Am I doing it wrong? </p>