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