title: OpenGLES10: Apply Projection & Camera View
body: <p>I need a little help with this:
  android developers, Tutorials: OpenGLES10.
  <a href="http://developer.android.com/resources/tutorials/opengl/opengl-es10.html" rel="nofollow">a link</a></p>
  
  <p>It all works fine for the first Triangle, until I put in the code for Projection &amp; Camera View. This should rezise OpenGLES Square view to match Phone's screen, so object stay in propotions.
  As a Newbie watching, the code looks fine and i have cheked with referencefiles, that there's not missing a parameter or something like that. But now i'm lost..! Can't see what's wrong.
  If Projection and Camera code are applied, there is no triangle, but the app. is runing and the View with backgroundcolor are shown.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    package notme.helloopengles10;
  
  import java.nio.ByteBuffer;
  import java.nio.ByteOrder;
  import java.nio.FloatBuffer;
  
  import javax.microedition.khronos.egl.EGLConfig;
  import javax.microedition.khronos.opengles.GL10;
  
  import android.opengl.GLSurfaceView;
  import android.opengl.GLU;
  
  public class HelloOpenGLES10Renderer implements GLSurfaceView.Renderer {
  
  // Set the background frame color
  public void onSurfaceCreated(GL10 gl, EGLConfig config) {
      gl.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
  
      // initialize the triangle vertex array
      initShapes();
      //enable use of vertex arrays
      gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  }
  
  public void onDrawFrame(GL10 gl) {
      // Redraw background color  
      gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
  
   /* // set GL_MODELVIEW transformation mode (If outline from here to after GLU.gluLookAt() - it works when also outlines further down i code!
      gl.glMatrixMode(GL10.GL_MODELVIEW);
      gl.glLoadIdentity();  // reset Matrix to its default state
  
      // when using GL_MODELVIEW, you must set the view point
      GLU.gluLookAt(gl, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f);  */
  
      //Draw Triangel
      gl.glColor4f(0.63671875f, 0.76953125f, 0.22265625f, 0.0f);
      gl.glVertexPointer(3, GL10.GL_FLOAT, 0, triangleVB);
      gl.glDrawArrays(GL10.GL_TRIANGLES, 0, 3);
  }
  
  // Redraw on orientation changes // adjust for screen size ratio
  public void onSurfaceChanged(GL10 gl, int width, int height) {
      gl.glViewport(0, 0, width, height);
  
      // Make adjustments  for screen ratio 
   /*(If outline from here to after gl.Frumstumf() - it works!
      float ratio = (float) width / height;
      gl.glMatrixMode(GL10.GL_PROJECTION);  // set matrix to projection mode
      gl.glLoadIdentity();                  // reset the matrix to its default state
      gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7);        // apply the projection   */
  
  }
  
  /*
   * Draw a shape, a triangle. first add new member variable to contain
  * the vertices of a triangle
  */
   private FloatBuffer triangleVB;
  
  //Create a method, initShaoe(), which populate the members variable
   private void initShapes(){
       //create a array 
       float triangleCoords[] = {
               // X, Y, Z
               -0.5f, -0.25f, 0,
               0.5f, -0.25f, 0,
               0.0f, 0,559016994f, 0
       };
   // initialize vertex Buffer for triangle
       ByteBuffer vbb= ByteBuffer.allocateDirect(
               //(# of coordinates values * 4 bytes per float)
               triangleCoords.length * 4 );
       vbb.order(ByteOrder.nativeOrder()); // use device hardware's native byte order
       triangleVB = vbb.asFloatBuffer(); //create floating point buffer from the ByteBuffer
       triangleVB.put(triangleCoords);  // add coordinates to the FloatBuffer
       triangleVB.position(0);  // set the buffer to read the first coordinate
   }
  
  
  } // end
  </code></pre>
  
  <p>I hope some one can tell me, where things go wrong?</p>
  
  <p>DevTool: Eclipse. </p>