0

我正在使用 NinevehGL 3D 引擎http://nineveh.gl/

我想获取 OpenGL 对象的屏幕截图。问题在于下面的代码

-(UIImage *) screenshot
{

// Capture screen here... and cut the appropriate size for saving and uploading
UIGraphicsBeginImageContext([self theNGLView].bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

// crop the area you want
CGRect rect;
rect = CGRectMake(0, 10, 300, 300);    // whatever you want
CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], rect);
UIImage *img = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
return img;  
}

只有背景出现在屏幕截图中,而不是实际的 NGLView 或绘制在它上面的 OpenGL 对象。

我正在使用 iOS SDK 6.0

4

2 回答 2

0

请通过此链接,您需要下载最新的适用于 iPhone5/iOS 6 的 NinevehGL SDK,该 SDK 在他们的twitter 链接中提供。

于 2013-09-06T09:59:35.160 回答
0

尝试使用

[[self the NGLView].layer renderInContext:UIGraphicsGetCurrentContext()];

?

于 2013-09-06T09:46:50.413 回答