UIImage *showImage = [UIImage imageNamed:@"demo.jpg"];
    CGRect rect = CGRectMake(, , showImage.size.width, showImage.size.height);
    //获取OpenGLES需然然的上下文
    EAGLContext *eagContext = [[EAGLContext alloc]initWithAPI:kEAGLRenderingAPIOpenGLES2];
    //创建出渲染的buffer
    
    _glkView = [[GLKView alloc]initWithFrame:rect context:eagContext];
    [_glkView bindDrawable];//绑定绘制
    [self.view addSubview:_glkView];
    
    //创建出CoreImage用的上下文
    _ciContext = [CIContext contextWithEAGLContext:eagContext options:@{kCIContextWorkingColorSpace:[NSNull null]}];
    
    //CoreImage相关设置
    _ciImage = [[CIImage alloc]initWithImage:showImage];
    _filter = [CIFilter filterWithName:@"CISepiaTone"];
    [_filter setValue:_ciImage forKey:kCIInputImageKey];
    [_filter setValue:@() forKey:kCIInputIntensityKey];
    
    //开始渲染
    [_ciContext drawImage:[_filter outputImage] inRect:CGRectMake(, , _glkView.drawableWidth, _glkView.drawableHeight) fromRect:[_ciImage extent]];
    [_glkView display];//显示出来

动态渲染,改变value值就行了

- (IBAction)sliderIsChange:(UISlider *)sender {

        [_filter setValue:_ciImage forKey:kCIInputImageKey];
        [_filter setValue:@(sender.value) forKey:kCIInputIntensityKey];
    
        //开始渲染
        [_ciContext drawImage:[_filter outputImage] inRect:CGRectMake(, , _glkView.drawableWidth, _glkView.drawableHeight) fromRect:[_ciImage extent]];
        [_glkView display];
}

补充:需倒入框架#import <GLKit/GLKit.h>

属性:

@property (weak, nonatomic) IBOutlet UISlider *slider;
@property (nonatomic,strong)GLKView *glkView; //渲染buffer视图

@property (nonatomic,strong)CIFilter *filter;
@property (nonatomic,strong)CIImage *ciImage;
@property (nonatomic,strong)CIContext *ciContext;

iOS-OpenGLES 简单渲染的更多相关文章

  1. iOS离屏渲染之优化分析

    在进行iOS的应用开发过程中,有时候会出现卡顿的问题,虽然iOS设备的性能越来越高,但是卡顿的问题还是有可能会出现,而离屏渲染是造成卡顿的原因之一.因此,本文主要分析一下离屏渲染产生的原因及避免的方法 ...

  2. iOS离屏渲染的解释:渲染与cpu、gpu

    重开一个环境(内存.资源.上下文)来完成(部分)图片的绘制 指的是GPU在当前屏幕缓冲区以外新开辟一个缓冲区进行渲染操作 意为离屏渲染,指的是GPU在当前屏幕缓冲区以外新开辟一个缓冲区进行渲染操作. ...

  3. iOS上简单推送通知(Push Notification)的实现

    iOS上简单推送通知(Push Notification)的实现 根据这篇很好的教程(http://www.raywenderlich.com/3443/apple-push-notification ...

  4. iOS 的 Gif 渲染引擎 FLAnimatedImage-b

    公司的项目有个首页加载一张2M左右的git图,刚做的时候是使用的SDWebImage里面的方法: + (UIImage *)sd_animatedGIFNamed:(NSString *)name; ...

  5. PIE SDK矢量数据简单渲染

    1. 功能简介 PIE SDK对数据的符号化分为矢量数据渲染和栅格数据渲染两大类. 目前PIE SDK中针对矢量数据渲染包括简单渲染.唯一值渲染.分级渲染.自定义渲染:针对栅格数据渲染包括拉伸渲染.R ...

  6. iOS CAReplicatorLayer 简单动画

    代码地址如下:http://www.demodashi.com/demo/11601.html 写在最前面,最近在看学习的时候,偶然间发现一个没有用过的Layer,于是抽空研究了下,本来应该能提前记录 ...

  7. iOS之简单瀑布流的实现

    iOS之简单瀑布流的实现   前言 超简单的瀑布流实现,这里说一下笔者的思路,详细代码在这里. 实现思路 collectionView能实现各中吊炸天的布局,其精髓就在于UICollectionVie ...

  8. iOS 的 Gif 渲染

    关于gif的展示,有些项目中很少用到,所以有的人对于这方面了解不是很多 下面介绍几种展示gif的方法,希望大家可以用得上,有更好的方法欢迎评论区留言 一,展示本地的gif,使用的SDWebImage里 ...

  9. iOS给图片添加滤镜&使用openGLES动态渲染图片

    给图片增加滤镜有这两种方式: CoreImage / openGLES 下面先说明如何使用CoreImage给图片添加滤镜, 主要为以下步骤: #1.导入CIImage格式的原始图片 #2.创建CIF ...

  10. [ios][opengles]GLKit如何搭一个app的框架

    一个外文对GLKit的讲解: Beginning OpenGL ES 2.0 with GLKit Part 1    英文原文链接:http://www.raywenderlich.com/5223 ...

随机推荐

  1. C扩展 C++回顾到入门

    引言 C扩展也称C++, 是一个复(za)杂(ji)优(ken)秀(die)的语言. 本文通过开发中常用C++方式来了解和回顾C++这么语言. C++看了较多的书但还是觉得什么都不会. 只能说自己还付 ...

  2. 【FAQ】【JSP】HTTP Status 500 - Summary(问题排查时候应该仔细分析所有的错误打印说明)

    Question 1.HTTP Status 500 - Unable to compile class for JSP:'***' cannot be resolved to a type 原因分析 ...

  3. winform 表单正则表达式验证 示例(ValidationRule)

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  4. 31.DDR2问题3_waring?

    Warning: (vlog-2275) 'ddr2_controller' already exists and will be overwritte. 出现这个waring,是因为xxx_bb.v ...

  5. 【转载】如何在FPGA设计环境中添加加时序约束

    转自:http://bbs.ednchina.com/BLOG_ARTICLE_198929.HTM 如何在FPGA设计环境中加时序约束    在给FPGA做逻辑综合和布局布线时,需要在工具中设定时序 ...

  6. label swift

    var label = UILabel(frame: CGRectMake(10, 20, 300, 100)) label.text = "<Swift语言实战入门>" ...

  7. AppDelegate中的方法解析

    // 当应用程序启动完毕的时候就会调用(系统自动调用) -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOp ...

  8. 实现压缩access(*.mdb)数据库的方法

    下面的函数用来压缩access数据库 需要增加ComObj单元 //压缩与修复数据库,覆盖源文件 function CompactDatabase(AFileName,APassWord:string ...

  9. 推荐一款系统软件:Unity tweak tool

    功能很多慢慢体会 在软件中心搜索unity tweak tool安装

  10. 微软职位内部推荐-Sr SDE

    微软近期Open的职位: MSN reaches nearly half a billion people across the globe where we are the #1 portal in ...