title: CAOpenGLLayer to image
body: <p>Is there any way to capture the contents of a <code>CAOpenGLLayer</code> as an image?</p>
  
  <p>The <code>CALayer</code> route using <code>renderInContext:</code> doesn't work (empty image) in 10.14 and as per Apple's comments:</p>
  
  <blockquote>
    <p>The OS X v10.5 implementation of this method does not support the
    entire Core Animation composition model. QCCompositionLayer,
    CAOpenGLLayer, and QTMovieLayer layers are not rendered.</p>
  </blockquote>
  
  <p>Apparently this was never fixed.</p>
  
  <p>The <code>NSView</code> route using</p>
  
  <pre><code>NSBitmapImageRep* rep = [self bitmapImageRepForCachingDisplayInRect:self.bounds];
  [self cacheDisplayInRect:self.bounds toBitmapImageRep:rep];
  </code></pre>
  
  <p>doesn't work either resulting in an equally empty image..</p>
  
  <p>When invoked on the view containing the <code>CAOpenGLLayer</code> it results in an entirely empty image, on the view's window's <code>contentView</code> the window content is there -<br>
  except for the area covered by the OpenGL view, which is neatly 'cut out' (blank)..</p>
  
  <p>Any suggestions on how to render OpenGL content to an <code>NSImage</code> much appreciated.</p>