openGL ES截屏

来源:互联网 发布:js实现加载的图片转动 编辑:程序博客网 时间:2024/06/06 01:35

先上截屏代码:
- (UIImage*)snapshotInternalOnIOS7AndLater
{

UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0.0);// Render our snapshot into the image context[self drawViewHierarchyInRect:self.bounds afterScreenUpdates:NO];// Grab the image from the contextUIImage *complexViewImage = UIGraphicsGetImageFromCurrentImageContext();// Finish using the contextUIGraphicsEndImageContext();return complexViewImage;

}
/*self是当前要截屏的部分
**/
我要做的是对一个用OpenGL ES渲染的播放器截屏,用正常的OpenGL截屏代码(比如这个:http://blog.csdn.net/meegomeego/article/details/8089433)在iPhone5s以上的设备上没问题,但是在iPhone5、4s及4上截屏出来的是黑屏,一直没找到原因(这个播放器是百度封装的.a库,看不到播放器的源码,所以debug无从搞起)。然后在github上找了一个开源的播放器(https://github.com/Bilibili/ijkplayer),在里面扒除了上面的截屏代码,可以用,但是我没搞懂OpenGL ES代码为什么在iPhone5上拿不到数据,望看到的大神帮忙解惑~

0 0
原创粉丝点击