title: Android OpenGL ES texture TextImage2D error
body: <p>Due to some unfathomable reason, the textures won't load.</p>
  
  <p>Here's the method </p>
  
  <pre><code>     public static void loadGLTexture(GL10 gl, Context context){
  
       BitmapFactory.Options options = new BitmapFactory.Options();
       options.inDensity = 240;// needed so that the image will be 512x512
  
      Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.glasstexture, options); 
      int width = bitmap.getWidth();
      int height = bitmap.getHeight();
  
      Log.i("GridLoginSquare.loadGLTexture 96", "Bitmap:{w:" + width + " h:" + height + "}");
  
      gl.glGenTextures(1, textures, 0);
      gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);
  
      // create nearest filtered texture
      gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
      gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
  
      // Use Android GLUtils to specify a two-dimensional texture image from our bitmap
      GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);  //error is on this line
  
      Log.e("GridLoginSquare.loadGLTexture 102", " ERR "+gl.glGetError()); 
      // Clean up
  
      bitmap.recycle();           
  }
  </code></pre>
  
  <p>The size of my texture image is 405 x 512</p>
  
  <p>The line <code>Log.e("GridLoginSquare.loadGLTexture 102", " ERR "+gl.glGetError());</code> gives
  me a 1281 error which (after investigating others who had similar problems) means
  <code>INVALID_VALUE</code></p>
  
  <p>The above code is a part of the overall <code>GridLoginSquare</code> class which is <a href="https://gist.github.com/f1d98be8ce8345674519" rel="nofollow">here</a></p>
  
  <p><strong>NOTE</strong> This problem had already persisted before <code>BitmapFactory.Options</code> density was included to scale the image. Similarly the texture uv was divided by 405 and 512 when this was included in the gist code.</p>