title: drawing rectangle in opengl android
body: <p>I am trying to draw a rectangle using android opengl. The rectangle will be formed within a colorful background. After running the code i can see a background but no rectangle inside it.</p>
  
  <pre><code>public void onDrawFrame(GL10 gl) 
  {
      gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);        
      gl.glClearColor(0.4f, 0.5f, 0.6f, 0.5f);
      gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);       
      float[] vertices=
      {
              -1.0f, 1.0f, 0.0f, 
              -1.0f, -1.0f, 0.0f,
              1.0f, -1.0f, 0.0f, 
              1.0f, 1.0f, 0.0f,               
      };
      short[] indices = { 0, 1, 2, 0, 2, 3 };     
      ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length * 4);
      vbb.order(ByteOrder.nativeOrder());
      FloatBuffer vertexBuffer = vbb.asFloatBuffer();
      vertexBuffer.put(vertices);
      vertexBuffer.position(0);       
      ByteBuffer ibb = ByteBuffer.allocateDirect(indices.length * 2);
      ibb.order(ByteOrder.nativeOrder());
      ShortBuffer indexBuffer = ibb.asShortBuffer();
      indexBuffer.put(indices);
      indexBuffer.position(0);
      gl.glFrontFace(GL10.GL_CCW);
      gl.glEnable(GL10.GL_CULL_FACE);
      gl.glCullFace(GL10.GL_BACK);
      gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);       
      gl.glColor4f(0.5f, 0.3f, 0.3f, 0.7f);
      gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
      gl.glDrawElements(GL10.GL_TRIANGLES, indices.length,
      GL10.GL_UNSIGNED_SHORT, indexBuffer);
      gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
      gl.glDisable(GL10.GL_CULL_FACE);
  }
  public void onSurfaceChanged(GL10 gl, int width, int height) 
  {
      gl.glViewport(0, 0, width, height);
      gl.glMatrixMode(GL10.GL_PROJECTION);
      gl.glLoadIdentity();
      GLU.gluPerspective(gl, 45.0f,
      (float) width / (float) height,
      0.1f, 100.0f);
      gl.glMatrixMode(GL10.GL_MODELVIEW);
      gl.glLoadIdentity();
  
  }
  public void onSurfaceCreated(GL10 gl, EGLConfig arg1) 
  {
      gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
      gl.glShadeModel(GL10.GL_SMOOTH);
      gl.glClearDepthf(1.0f);
      gl.glEnable(GL10.GL_DEPTH_TEST);
      gl.glDepthFunc(GL10.GL_LEQUAL);
      gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);     
  
  }
  </code></pre>
  
  <p>what's wrong in my code? Any suggestions please....</p>