title: Drawing quad in OpenGL ES on Android
body: <p>I am just trying to understand what is going on here. I have a textured quad on the screen but I am really confused why it takes up the entire screen. If my texture is 64X64 and I wanted a quad at the top left of the screen that was 64X64 what would I need to change? Is my viewport or my vertices positions causing it to take up the whole screen?</p>
  
  <p>With changes so far:</p>
  
  <pre><code>public void onSurfaceCreated(GL10 gl, EGLConfig config) {
  
          myquad.loadGLTexture(gl, this.context);
  
          gl.glEnable(GL10.GL_BLEND);
          gl.glBlendFunc(gl.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
          gl.glEnable(GL10.GL_TEXTURE_2D);
          gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
          gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
          gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
          gl.glDisable(GL10.GL_DEPTH_TEST);
      }
  
      public void onSurfaceChanged(GL10 gl, int w, int h) {
          width=w;
          height=h;
          gl.glViewport(0, 0, w, h);
          gl.glLoadIdentity();
          gl.glOrthof(0.0f, w, 0, h, -1.0f, 1.0f);        
      }
  
      public void onDrawFrame(GL10 gl) {
          // define the color we want to be displayed as the "clipping wall"
          gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
          // clear the color buffer to show the ClearColor we called above...
          gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
          gl.glLoadIdentity();
  
          myquad.Draw(gl);
          //gl.glTranslatef(.5f, 2.0f, 0.0f);
          //gl.glScalef(.5f, .5f, 0);
      }
  
  private float vertices[] = {
           // Vertices for the square
            -1.0f, -1.0f,  0.0f,  // 0. left-bottom
             1.0f, -1.0f,  0.0f,  // 1. right-bottom
            -1.0f,  1.0f,  0.0f,  // 2. left-top
             1.0f,  1.0f,  0.0f   // 3. right-top
  };
  
  private float texture[] = {          
          //Mapping coordinates for the vertices
          0.0f, 1.0f,
          1.0f, 0.0f,
          1.0f, 1.0f,
          0.0f, 1.0f, 
  };
  public void Draw(GL10 gl)
  {   
      // set the color for the triangle
      gl.glColor4f(0.0f, 1.0f, 0.0f, 0.5f);
  
      //Enable the vertex and texture state
      gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, texturebuffer);
      gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexbuffer);
  
      //gl.glTranslatex(-20, 0, 0);
      // Draw the vertices as triangle strip
      gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3);
  
  }
  </code></pre>