title: How to re-write 2D OpenGL app for OpenGL ES?
body: <p>I am working on an OpenGL 2D game with sprite graphics. I was recently advised that I should use OpenGL ES calls as it is a subset of OpenGL and would allow me to port it more easily to mobile platforms. The majority of the code is just calls to a draw_image function, which is defined so:</p>
  
  <pre><code>void draw_img(float x, float y, float w, float h, GLuint tex,float r=1,float g=1, float b=1) {
      glColor3f(r,g,b);
      glEnable(GL_TEXTURE_2D);
      glBindTexture(GL_TEXTURE_2D, tex);
      glBegin(GL_QUADS);
          glTexCoord2f(0.0f, 0.0f);
          glVertex2f( x, y);
          glTexCoord2f(1.0f, 0.0f);
          glVertex2f(w+x, y);
          glTexCoord2f(1.0f, 1.0f);
          glVertex2f( w+x, h+y);
          glTexCoord2f(0.0f, 1.0f);
          glVertex2f( x, h+y);
      glEnd();
  }
  </code></pre>
  
  <p>What do I need to change to make this OpenGL ES compatible? Also, the reason I am using fixed-function rather than shaders is that I am developing on a machine which doesn't support GLSL.</p>