Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot create a Screenshot of a SCNView

Tags:

scenekit

Is it possible to get a screenshot of an SCNView? I'm trying with the below code, but it always comes out white...

NSRect bounds = [window.contentView bounds];
NSImage *screenshot = [[NSImage alloc] initWithData:[window.contentView dataWithPDFInsideRect:bounds]];

It works fine when the view is a standard NSView...

like image 929
Chris Avatar asked May 06 '14 19:05

Chris


1 Answers

In OS X v10.10 and iOS 8, SCNView adds a snapshot method, so you can get an NSImage (or UIImage) out of it much more easily.

like image 200
rickster Avatar answered Oct 02 '22 18:10

rickster