title: Android OpenGL ES texture animation
body: <p>I'm developing a game for android and this is my first experience with OpenGL.
  When the application loads I create my vertices and texture buffers, I load images from drawable resources; using GLUtils.tex2Image2D to bind the image to a texture array.</p>
  
  <p>I was wondering if glBindTexture() was the correct function to use when changing the texture to produce animation.</p>
  
  <pre><code>public void onDraw(GL10 gl){
      sprite.animate();
      gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[sprite.frameNumber]);
      sprite.draw(gl);
  }
  </code></pre>
  
  <h2>Code Explanation</h2>
  
  <p><em>sprite.animate()</em> - changes the frame number depending on System.uptimeMillis()</p>
  
  <p><em>sprite.draw()</em> - does the actual drawing:</p>
  
  <pre><code>gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
  
  gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
  gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer);
  
  gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3);
  
  //Disable the client state before leaving
  gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
  </code></pre>
  
  <p>The function does work, but I wanted to confirm it was the correct function to use, or if there is an alternative way to do this.</p>