title: glReadPixels GL_DEPTH_COMPONENT and color
body: <p>How to get the depth and the color information out of any OpenGL drawing? I would like to save a depth image and a color image to the disk. What i tried is the following:</p>
  
  <pre><code>    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glEnable(GL_DEPTH_TEST);
  
  glBegin(GL_POINTS);
      glColor3f(1.0f,1.0f,1.0f); 
      for(int i=0; i&lt;mesh-&gt;vertices.size();i++) {
  
          if(! mesh-&gt;colors.empty()) {
              glColor3f(mesh-&gt;colors[i][0],mesh-&gt;colors[i][1],mesh-&gt;colors[i][2]); 
          }   
  
          float x= mesh-&gt;vertices[i][0];
          float y= mesh-&gt;vertices[i][1];
          float z = mesh-&gt;vertices[i][2];         
          glVertex3f(x, y, z);
  
      }
  
  glEnd();
  
  glFlush();
  glFinish();
  
  int width = 1280;
  int height = 960;
  
  GLfloat* depths;
  depths = new GLfloat[ width * height ];
  
  GLfloat * color;
  color = new GLfloat[width * height];
  
  glReadPixels (0, 0, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depths); 
  glReadPixels (0, 0, width, height, GL_BLUE, GL_FLOAT, color);
  </code></pre>
  
  <p>But it looks like only the depths array is filled?</p>