title: Android OpenGL: How to change bitmap attached to texture?
body: <p>I have created a texture like this</p>
  
  <pre><code>public int createTexture(Bitmap bitmap){
   final int[] textureHandle = new int[1];
   GLES20.glGenTextures(1, textureHandle, 0);
   glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle[0]);       
   glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
   glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
   // Load the bitmap into the bound texture.
   GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0); 
   return textureHandle[0];
  }
  </code></pre>
  
  <p>Now based on the user input I want to update my <code>Texture</code> with the new <code>Bitmap</code>. I tried recalling same function with different <code>Bitmap</code> but its not getting updated. Am I doing something wrong here? </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I tried as Tommy said in his answer but no use. Let me elaborate how I am using textures.</p>
  
  <pre><code>public void changeFilter(){
    //create required bitmap here
    if(mTextureDataHandle1==0) 
      mTextureDataHandle1 =loadTexture(bitmap); 
    else 
        updateTexture(mTextureDataHandle1);
  }
  </code></pre>
  
  <p>In <code>onDrawFrame</code> </p>
  
  <pre><code> glActiveTexture(GL_TEXTURE1);
   glBindTexture(GL_TEXTURE_2D, mTextureDataHandle1);
   glUniform1i(mTextureUniformHandle1, 1);
  </code></pre>