title: problem with glreadPixels on iphone
body: <p>I have no problem drawing a texture to the screen but I cant get the right pixels when printing them from memory. I have a 4x4 png image with 4 black pixels and I am trying to print them. This is what I do:</p>
  
  <pre><code>glBindTexture(GL_TEXTURE_2D, m_textureId);
  
  const int size = m_width * m_height * 4;
  GLubyte pixels[size];
  
  glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
  if(glGetError() != GL_NO_ERROR)
      assert(false &amp;&amp; "opengl error");
  
  
  for(int index = 0; index &lt; size; index+=4)
  {
      cout &lt;&lt; "red " &lt;&lt; (unsigned)pixels[index+0] &lt;&lt; endl;
      cout &lt;&lt; "green " &lt;&lt; (unsigned)pixels[index+1] &lt;&lt; endl;
      cout &lt;&lt; "blue " &lt;&lt; (unsigned)pixels[index+2] &lt;&lt; endl;
  }
  </code></pre>
  
  <p>But I get all random values and not the one I expect. Can anyone see what I am doing wrong?</p>