title: Strange opengl es 2 on android error
body: <p>i tried to do tutorial from <a href="http://developer.android.com/resources/tutorials/opengl/opengl-es20.html" rel="nofollow">http://developer.android.com/resources/tutorials/opengl/opengl-es20.html</a>
  But what I wanted was to create it in multiple classes for easier edit.
  My problem is that eclipse does not show any kind of errors or problems, application runs but displays only white background (triangle is not shown) and logcat throws constantly errors 'called unimplemented OpenGL ES API'.
  I have no idea what I did wrong, and Eclipse don't show me where can the error be, can somebody tell me what is wrong or at least put me on tracks for solution?</p>
  
  <p>Edit: I run this app on htc desire with android 2.3.7. When I copy-pasted code from google tutorial everything ran perfectly.</p>
  
  <p>My classes look like that:</p>
  
  <p>Activity:</p>
  
  <pre><code>import android.app.Activity;
  import android.opengl.GLSurfaceView;
  import android.os.Bundle;
  import android.view.Window;
  import android.view.WindowManager;
  
  public class Androdvlpr2Activity extends Activity {
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      this.requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow().setFlags(
          WindowManager.LayoutParams.FLAG_FULLSCREEN,
          WindowManager.LayoutParams.FLAG_FULLSCREEN); 
  
      GLSurfaceView View = new GLSurfaceView(this);
      View.setRenderer(new Renderer());
      setContentView(View);
  }
  }
  </code></pre>
  
  <p>Renderer:</p>
  
  <pre><code>import javax.microedition.khronos.egl.EGLConfig;
  import javax.microedition.khronos.opengles.GL10;
  
  import android.opengl.GLES20;
  import android.opengl.GLSurfaceView;
  
  public class Renderer implements GLSurfaceView.Renderer {
  Triangle triangle = new Triangle();
  private int mProgram;
  private int maPositionHandle;
  
  public void onSurfaceCreated(GL10 unused, EGLConfig config) {
      GLES20.glClearColor(0.92f, 0.92f, 0.92f, 1.0f);
  
      Triangle.initTriangle();
  
  
      mProgram = GLES20.glCreateProgram();             // create empty OpenGL Program
      GLES20.glAttachShader(mProgram, Shader.vertexShader);   // add the vertex shader to program
      GLES20.glAttachShader(mProgram, Shader.fragmentShader); // add the fragment shader to program
      GLES20.glLinkProgram(mProgram);                  // creates OpenGL program executables
  
      // get handle to the vertex shader's vPosition member
      maPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");
  }
  
  public void onDrawFrame(GL10 unused) {
      GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
  
  
      GLES20.glUseProgram(mProgram);
      // Prepare the triangle data
      GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT, false, 12, Triangle.verticesBuffer);
      GLES20.glEnableVertexAttribArray(maPositionHandle);
      // Draw the triangle
      GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 3);
  }
  
  public void onSurfaceChanged(GL10 unused, int width, int height) {
  }  
  }
  </code></pre>
  
  <p>Triangle:</p>
  
  <pre><code>import java.nio.ByteBuffer;
  import java.nio.ByteOrder;
  import java.nio.FloatBuffer;
  
  public class Triangle {
  static FloatBuffer verticesBuffer = null;
  
  public static void initTriangle(){
      float triangleCoords[] = {
                  // X, Y, Z
                  -0.5f, -0.25f, 0,
                   0.5f, -0.25f, 0,
                   0.0f,  0.559016994f, 0
              }; 
  
      ByteBuffer vbb = ByteBuffer.allocateDirect(triangleCoords.length * 4);
      vbb.order(ByteOrder.nativeOrder());
      verticesBuffer = vbb.asFloatBuffer();
      verticesBuffer.put(triangleCoords);
      verticesBuffer.position(0);
  }
  }
  </code></pre>
  
  <p>Shader:</p>
  
  <pre><code>import android.opengl.GLES20;
  
  public class Shader {
      private final static String vertexShaderCode = 
          "attribute vec4 vPosition; \n" +
          "void main(){              \n" +
          " gl_Position = vPosition; \n" +
          "}                         \n";
  
      private final static String fragmentShaderCode = 
          "precision mediump float;  \n" +
          "void main(){              \n" +
          " gl_FragColor = vec4 (0.63671875, 0.76953125, 0.22265625, 1.0); \n" +
          "}                         \n";
  
      final static int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode);
      final static int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode);
  
  private static int loadShader(int type, String shaderCode){
  
      // create a vertex shader type (GLES20.GL_VERTEX_SHADER)
      // or a fragment shader type (GLES20.GL_FRAGMENT_SHADER)
      int shader = GLES20.glCreateShader(type); 
  
      // add the source code to the shader and compile it
      GLES20.glShaderSource(shader, shaderCode);
      GLES20.glCompileShader(shader);
  
      return shader;
  }
  }
  </code></pre>