0

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 able 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.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Shashank
  • 877
  • 7
  • 15
  • possible duplicate of [\[iPhone\] OpenGL transparent background](http://stackoverflow.com/questions/3193607/iphone-opengl-transparent-background) – Brad Larson May 28 '11 at 13:44

1 Answers1

0

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;

}

Xuvi
  • 519
  • 3
  • 9
  • Thanks for your reply. I am adding the CAEAGLLayer view as subview in my view and i am able 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. – Shashank May 28 '11 at 11:58