title: What's 'glBufferData' for in OpenGL ES?
body: <p>I run across a sample OpenGL code that I ported to OpenGL ES 2.0 (there wasn't much to be done actually), but I cannot help wondering what the <code>glBufferData</code> function is for. The original source is like that:</p>
  
  <pre><code>glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 2 * 6, quad, GL_STATIC_DRAW);
  glEnableVertexAttribArray(0);
  glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 2, (void *) 0);
  </code></pre>
  
  <p>But I can successfully simplify it as:</p>
  
  <pre><code>glEnableVertexAttribArray(0);
  glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 2, quad);
  </code></pre>
  
  <p>That is, I can omit the <code>glBufferData</code> function just by using a valid pointer to the quad array in <code>glVertexAttribPointer</code>.</p>
  
  <p>So, could anyone explain what's the <code>glBufferData</code> function for? From what I'm doing it seems to be redundant but that must be because of my serious lack of knowledge of the API. As a matter of fact I tried reading the docs at <a href="http://www.khronos.org/opengles/sdk/docs/man/xhtml/glBufferData.xml" rel="noreferrer">khronos.org</a> but this didn't help me understand its use.</p>