title: How to call glReadPixels on different thread?
body: <p>When I call glReadPixels on another thread, it doesn't return me any data. I read somewhere suggesting that I need to create a new context in the calling thread and copy the memory over. How exactly do I do this?</p>
  
  <p>This is the glReadPixels code I use:</p>
  
  <pre><code>pixels = new BYTE[ 3 * width * height];
  glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
  image = FreeImage_ConvertFromRawBits(pixels, width, height, 3 * width, 24, 0xFF0000, 0x00FF00, 0x0000FF, false);
  FreeImage_Save(FIF_PNG, image, pngpath.c_str() , 0);
  </code></pre>
  
  <p>Alternatively, I read from this <a href="http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&amp;Number=31173&amp;page=2" rel="nofollow">thread</a> they suggest to use another piece of code (see the end) but I dont understand what are origX, origY, srcOrigX, srcOrigY? </p>