title: glReadPixels and GL_ALPHA
body: <p>I'm trying to read the alpha pixel values using glReadPixels. The first thing I did was read the pixels individually. To try to speed things up, I tried reading all the pixels at once :</p>
  
  <pre><code>GLubyte *pixels = new GLubyte[w*h*4];
  glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
  </code></pre>
  
  <p>and it worked, but really slow. Now I'm trying to just retrieve the alpha value, without wasting space to the RGB components :</p>
  
  <pre><code>GLubyte *pixels = new GLubyte[w*h];
  glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 
  glPixelStorei(GL_PACK_ALIGNMENT, 1);
  glReadPixels(0, 0, w, h, GL_ALPHA, GL_UNSIGNED_BYTE, pixels);
  </code></pre>
  
  <p>But I get : <code>OpenGL error 0x0500 in -[EAGLView swapBuffers]</code>. </p>
  
  <p>Any idea as to why a <code>INVALID_ENUM (0x0500)</code> is thrown?</p>