public void drawInRect(GL10 gl,CGRect rect){
  gl.glEnable(GL_TEXTURE_2D);
  loadTexture(gl);
  float vertices[]={rect.origin.x,rect.origin.y,rect.origin.x + rect.size.width,rect.origin.y,rect.origin.x,rect.origin.y + rect.size.height,rect.origin.x + rect.size.width,rect.origin.y + rect.size.height};
  mVertices.put(vertices);
  mVertices.position(0);
  float coordinates[]={0.0f,_maxT,_maxS,_maxT,0.0f,0.0f,_maxS,0.0f};
  mCoordinates.put(coordinates);
  mCoordinates.position(0);
  gl.glEnableClientState(GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  gl.glBindTexture(GL_TEXTURE_2D,_name);
  gl.glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
  gl.glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
  gl.glVertexPointer(2,GL_FLOAT,0,mVertices);
  gl.glTexCoordPointer(2,GL_FLOAT,0,mCoordinates);
  gl.glDrawArrays(GL_TRIANGLE_STRIP,0,4);
  gl.glDisableClientState(GL_VERTEX_ARRAY);
  gl.glDisableClientState(GL_TEXTURE_COORD_ARRAY);
  gl.glDisable(GL_TEXTURE_2D);
}

public void drawInRect ( GL10 gl , CGRect rect ) { gl . glEnable ( GL_TEXTURE_2D ) ; loadTexture ( gl ) ; float vertices [ ] = { rect . origin . x , rect . origin . y , rect . origin . x + rect . size . width , rect . origin . y , rect . origin . x , rect . origin . y + rect . size . height , rect . origin . x + rect . size . width , rect . origin . y + rect . size . height } ; mVertices . put ( vertices ) ; mVertices . position ( 0 ) ; float coordinates [ ] = { 0.0f , _maxT , _maxS , _maxT , 0.0f , 0.0f , _maxS , 0.0f } ; mCoordinates . put ( coordinates ) ; mCoordinates . position ( 0 ) ; gl . glEnableClientState ( GL_VERTEX_ARRAY ) ; gl . glEnableClientState ( GL_TEXTURE_COORD_ARRAY ) ; gl . glBindTexture ( GL_TEXTURE_2D , _name ) ; gl . glTexParameterx ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_S , GL_REPEAT ) ; gl . glTexParameterx ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_T , GL_REPEAT ) ; gl . glVertexPointer ( 2 , GL_FLOAT , 0 , mVertices ) ; gl . glTexCoordPointer ( 2 , GL_FLOAT , 0 , mCoordinates ) ; gl . glDrawArrays ( GL_TRIANGLE_STRIP , 0 , 4 ) ; gl . glDisableClientState ( GL_VERTEX_ARRAY ) ; gl . glDisableClientState ( GL_TEXTURE_COORD_ARRAY ) ; gl . glDisable ( GL_TEXTURE_2D ) ; }
draws a texture inside a rect
