title: texture is flipped and upside down
body: <p>I am trying to draw a simple texture on top of simple square . </p>
  
  <p>However, the texture image is seen flipped and Upside down . I think I have all the texture definitions correct so I have no idea what's the problem . </p>
  
  <p>here is my texture loading code : </p>
  
  <pre><code>final int[] textureObjectIds = new int[1];
          GLES20.glGenTextures(1 , textureObjectIds , 0);
          if (textureObjectIds[0] == 0){
              Logger.Log( TAG , "Unable to generate new texture object");
          }
  
          //define options for decoding
          final BitmapFactory.Options options = new BitmapFactory.Options();
  
          options.inScaled = true ;
  
  
  
          final Bitmap bitmap = BitmapFactory.decodeResource(context.getResources() , resourceId , options); //decode texture resource to bitmap
          if (bitmap == null){
              Logger.Log(TAG, "Resource ID " + resourceId + " Could not be decoded");
              GLES20.glDeleteTextures(1 , textureObjectIds , 0);
              return 0;
          }
  
          GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureObjectIds[0]); //bind texture to our texture object
  
          // define magnify and minimize filters
          GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D , GLES20.GL_TEXTURE_MIN_FILTER , GLES20.GL_LINEAR_MIPMAP_LINEAR);
          GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D , GLES20.GL_TEXTURE_MAG_FILTER , GLES20.GL_LINEAR);
  
          //GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D , GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
          //GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D , GLES20.GL_TEXTURE_WRAP_T , GLES20.GL_CLAMP_TO_EDGE);
  
          GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0); // load bitmap data to texture
  
          bitmap.recycle(); // release recycle
  
          GLES20.glGenerateMipmap(GLES20.GL_TEXTURE_2D);
  
          GLES20.glBindTexture(GLES20.GL_TEXTURE_2D , 0); //unbind from the texture
  
          return textureObjectIds[0];
  </code></pre>
  
  <p>Coordinates of my square and texture : </p>
  
  <pre><code>private static final float TEXTURE_FLOOR  = 0.0f;
  private static final float TEXTURE_CEIL= 2.0f;
  
  private static final float[] VERTEX_DATA  = {
                                                                          //Coordinates : X , Y , Z , S , T
                                                                          //Triangle1
                                                                          -0.5f , -0.5f   , 0.0f , TEXTURE_FLOOR , TEXTURE_CEIL  ,
                                                                           0.5f , -0.5f   , 0.0f , TEXTURE_CEIL  , TEXTURE_CEIL ,
                                                                          -0.5f ,  0.5f   , 0.0f , TEXTURE_FLOOR , TEXTURE_FLOOR ,
  
                                                                          //Triangle2
                                                                           0.5f  , -0.5f  , 0.0f , TEXTURE_CEIL , TEXTURE_CEIL ,
                                                                           0.5f  ,  0.5f  , 0.0f , TEXTURE_CEIL  , TEXTURE_FLOOR ,
                                                                          -0.5f  ,  0.5f  , 0.0f , TEXTURE_FLOOR  , TEXTURE_FLOOR
                                                                        };
  </code></pre>
  
  <p>More info from the code : </p>
  
  <pre><code>private static final int     POSITION_COMPONENT_COUNT               = 3 ;
  private static final int     TEXTURE_COORDINATES_COMPONENT_COUNT    = 2 ;
  private static final int     STRIDE                                 =  (POSITION_COMPONENT_COUNT + TEXTURE_COORDINATES_COMPONENT_COUNT)
                                                                          * BYTES_PER_FLOAT ;
  
  vertexArray.setVertexAttribPointer(0 , textureShaderProgram.getPositionAttributeLocation() , POSITION_COMPONENT_COUNT , STRIDE);
  vertexArray.setVertexAttribPointer(POSITION_COMPONENT_COUNT, textureShaderProgram.getTextureCoordinatesAttributeLocation(), TEXTURE_COORDINATES_COMPONENT_COUNT, STRIDE);
  </code></pre>
  
  <p>where :</p>
  
  <pre><code>public void setVertexAttribPointer(int dataOffset , int attributeLocation , int componentCount , int stride){
      floatBuffer.position(0);
      GLES20.glVertexAttribPointer(attributeLocation, componentCount, GLES20.GL_FLOAT, false, stride, floatBuffer);
      GLES20.glEnableVertexAttribArray(attributeLocation);
      floatBuffer.position(0);
  </code></pre>
  
  <p>example image of my problem with a waze icon : 
  <a href="https://i.stack.imgur.com/uMjxg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uMjxg.png" alt="waze"></a></p>