title: What is the proper way to enable and disable GLES20 atributes?
body: <p>Firsty what am I creating: 2d tile based rpg game. 
  What I am currently doing I will post here, and comment some spots that I am not sure if I am using them correctly.</p>
  
  <p>In GlSurfaceViewRenderer:</p>
  
  <pre><code>@Override
  public void onSurfaceCreated(GL10 gl, EGLConfig config) {
     //I enable some attributes
     //Don't know if its needed in GLES20, there isnt GL20.GL_PERSPECTIVE_CORRECTION_HINT attribute at all
     GLES20.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST); 
     //next I don't really know if I need them all:
     GLES20.glClearColor(0, 0, 0, 1);
     GLES20.glClearDepthf(1.0f);
     GLES20.glDisable(GLES20.GL_CULL_FACE);// No culling of back faces
     GLES20.glDisable(GLES20.GL_DEPTH_TEST);
     GLES20.glEnable(GLES20.GL_TEXTURE_2D);
     GLES20.glDisable(GLES20.GL_DITHER);
     GLES20.glDisable(GL10.GL_LIGHTING);
     GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
     // for transperent pixels
     GLES20.glEnable(GLES20.GL_BLEND);
     GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);
  
     //Load shaders:  (1 vertex and fragment shader I hope is enouph)
     iProgId = Utils.LoadProgram(vertexShaderCode, fragmentShaderCode);
     GLES20.glUseProgram(iProgId);
     // get handle to vertex shader's vPosition member
     mPositionHandle = GLES20.glGetAttribLocation(iProgId, "vPosition");
     // get handle to textures shader's a_TexCoordinate member
     mTextureCoordinateHandle = GLES20.glGetAttribLocation(iProgId, "a_TexCoordinate");
     // get handle to transformation matrix
     mMVPMatrixHandle = GLES20.glGetUniformLocation(iProgId, "uMVPMatrix");
  
    //Now in here not sure:   some people enable arrays in every draw frame, I do it once:
    // Enable a handle to the triangle vertices   
    GLES20.glEnableVertexAttribArray(mPositionHandle);
    // Enable a handle to the texture vertices 
    GLES20.glEnableVertexAttribArray(mTextureCoordinateHandle);
  }
  
  @Override
  public void onSurfaceChanged(GL10 gl, int width, int height) {
      GLES20.glViewport(0, 0, width, height);
      Matrix.frustumM(mProjMatrix, 0, ratio, -ratio, 1, -1, 1, 10000);
      //.... and other
  }
  
  @Override
  public void onDrawFrame(GL10 gl) {
     GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
     //set camera position
     Matrix.setLookAtM(...);
     Matrix.multiplyMM(...);
  
     //begin drawing:
     for(Sprite spr : Sprite_list){
  
        spr.draw(){
           //whats happening in draw:
           //First setting the location of the sprite:
           Matrix.setIdentityM(...x &amp; y...);
           Matrix.translateM(...);
           Matrix.setIdentityM(...);
           Matrix.multiplyMM(...);
  
           //Some developers enables vertex attrib arrays here and then disables at the                                        end of this drawing method. But I enable it in on surface created and don't disable it, maybe it's faster this way, not sure.
           // Prepare the triangle coordinate data
           GLES20.glVertexAttribPointer(GLRenderer.mPositionHandle, DIMENSION,            GLES20.GL_FLOAT, false, vertexStride, vertexBuffer);
           // Prepare the triangle coordinate data
           GLES20.glVertexAttribPointer(GLRenderer.mTextureCoordinateHandle, DIMENSION, GLES20.GL_FLOAT, false, vertexStride, textureBuffer);
  
           GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textID);
           GLES20.glUniformMatrix4fv(GLRenderer.mMVPMatrixHandle, 1, false, GLRenderer.mMVPMatrix, 0);
  
           GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
  
        }
  
     }
  
  }
  </code></pre>
  
  <p>And everything works, for now, but I really not sure if I am doing any mistakes here, can someone elaborate? </p>