OpenGLES下进行渲染
来源:互联网 发布:水利网络培训 编辑:程序博客网 时间:2024/06/06 14:20
头文件加上#import <GLKit/GLKit.h>
@property(nonatomic,strong)GLKView *glkView;
@property(nonatomic,strong)CIFilter *filter;
@property(nonatomic,strong)CIImage *ciImage;
@property(nonatomic,strong)CIContext *ciContext;
UIImage *showImage = [UIImageimageNamed:@"demo"];
CGRect rect = CGRectMake(0,0, showImage.size.width, showImage.size.height);
//获取OpenGLES渲染的上下文
EAGLContext *eagContext = [[EAGLContextalloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
//创建出渲染的butter
_glkView = [[GLKViewalloc] initWithFrame:rectcontext:eagContext];
[_glkViewbindDrawable];
[self.viewaddSubview:_glkView];
//创建出CoreImage用的上下文
_ciContext = [CIContextcontextWithEAGLContext:eagContext options:@{kCIContextWorkingColorSpace:[NSNullnull]}];
//CoreImage相关的设置
_ciImage = [[CIImagealloc] initWithImage:showImage];
_filter = [CIFilterfilterWithName:@"CISepiaTone"];
[_filtersetValue:_ciImageforKey:kCIInputImageKey];
[_filtersetValue:@(0)forKey:kCIInputIntensityKey];
// NSLog(@"%@",_filter.attributes);
//开始渲染
[_ciContextdrawImage:[_filteroutputImage]
inRect:CGRectMake(0,0, _glkView.drawableWidth,_glkView.drawableHeight)
fromRect:[_ciImageextent]];
[_glkViewdisplay];
//动态渲染
UISlider *slider = [[UISlideralloc] initWithFrame:CGRectMake(0,400, 320, 20)];
slider.minimumValue =0.f;
slider.maximumValue =1.f;
[slider addTarget:selfaction:@selector(sliderEvent:)forControlEvents:UIControlEventValueChanged];
[self.viewaddSubview:slider];
-(void)sliderEvent:(UISlider *)slider{
[_filtersetValue:_ciImageforKey:kCIInputImageKey];
[_filtersetValue:@(slider.value)forKey:kCIInputIntensityKey];
//开始渲染
[_ciContextdrawImage:[_filteroutputImage] inRect:CGRectMake(0,0, _glkView.drawableWidth,_glkView.drawableHeight ) fromRect:[_ciImageextent]];
[_glkViewdisplay];
}
- OpenGLES下进行渲染
- OpenGLES下进行渲染
- opengles渲染流程
- Android OpenglEs渲染yuv
- opengles的渲染管线
- opengles 2.0 渲染Yuv视频
- opengles 2D渲染性能
- OpenGLES入门一之渲染窗口
- Yii对不同控制器下的视图进行渲染
- Directx11教程四十二下之进行骨骼动画的渲染
- opengles
- opengles
- opengles
- Opengles
- OpenGLES
- Cocos2dx引擎11-OpenGLES渲染之Shader准备
- iOS中滤镜的使用(三)OpenGLES渲染
- android下opengles调试小技巧
- linux中查看现在使用的shell是ksh还是bash?以及怎样修改?
- 如何验证C语言中小数默认是double类型
- 关于java.lang.VerifyError的另外一种错误原因
- 数据结构 并查集 路径压缩
- Python文件操作注意事项
- OpenGLES下进行渲染
- MySQL无法存储Emoji表情问题
- javascript面向对象编程
- Hello world
- gdb 调试
- android imageview
- nyoj 8一种排序
- Oracle提交和回滚处理
- fastcgi配置