Capturing 3d object with its Background view in iPhone
I am new in Open GLES. I got stuck at capturing the 3d object with its Background image. I am adding the CAEAGLLayer view as subview in my view and i am abl开发者_如何学JAVAe to take the image of 3d object but it is coming with black background but i want to take the image of whole view on which i am showing my 3d object. So please help me to resolve this issue.
You need to give more information. What is the background?
- You use 1 view, it is
EAGLView
the I guess you should get the correct result. - You use EAGLView as subview of your
background
then you need to capture 2 images then combine them into one.
Call [CALayer drawInContext:viewContext]
to get image of your background
view.
Combine 2 images
+ (UIImage *) imageFromImage:(UIImage *)img1 andImage:(UIImage*) img2 {
UIGraphicsBeginImageContext(img1.size);
[img1 drawAtPoint:CGPointMake(0, 0)];
[img2 drawAtPoint:CGPointMake(0, 0)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
精彩评论