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. 九度oj 1525 子串逆序打印

    原题链接:http://ac.jobdu.com/problem.php?pid=1525 字符串简单题,注意开有结尾有空格的情况否则pe or wa #include<algorithm> ...

  2. php webservice soap

    http://www.cnblogs.com/phpdragon/archive/2012/06/10/2544171.html http://jeffxie.blog.51cto.com/13653 ...

  3. 插入排序 & 快速排序

    2.1 插入排序: 接口定义: int insert_sort(void* data, int size, int esize, int (*compare)(const void* key1, co ...

  4. iOS-NSDate 相差 8 小时

    转载自:http://blog.csdn.net/diyagoanyhacker/article/details/7096612 NSDate存储的是世界标准时(UTC),输出时需要根据时区转换为本地 ...

  5. < java.lang >-- StringBuilder字符串缓冲区

    JDK1.5出现StringBuiler:构造一个其中不带字符的字符串生成器,初始容量为 16 个字符.该类被设计用作 StringBuffer 的一个简易替换,用在字符串缓冲区被单个线程使用的时候( ...

  6. OpenGL学习笔记之配置OpenGL

    OpenGL是计算机图形学领域的一门入门语言,OpenGL开发库的一些文件在官网上可以下载到.里面包含三个文件,如下: 1.把在OpenGL开发库中LIB(库文件)glut.lib和glut32.li ...

  7. hadoop HA 之 QJM

    前言 本文主要通过对hadoop2.2.0集群配置的过程加以梳理,所有的步骤都是通过自己实际测试.文档的结构也是根据自己的实际情况而定,同时也会加入自己在实际过程遇到的问题.搭建环境过程不重要,重要点 ...

  8. Android BLE API: GATT Notification not received

    When setting the value to the descriptor instead of putting descriptor.setValue(BluetoothGattDescrip ...

  9. Leetcode-Construct Binary Tree from inorder and preorder travesal

    Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that ...

  10. 一些 Shell 脚本(持续更新)

    1. 启动日志分析 启动日志格式如下: 开机时间:2015/05/13 周三 16:45:17.79 关机时间:2015/05/13 周三 18:46:03.91 开机时间:2015/05/14 周四 ...