GPUImage学习

1.GLProgram--加载vertex和fragment的shader。

 好处是完全将shader模块的加载过程独立出来。

 学习:每个函数处理一件事,且函数的粒度刚好

    在glLinkProgram后就可以将shader给清除掉

    输出shader和program的log也值得借鉴

2.GPUImageContext--管理EAGLContext ,由于它是一个单例,用它来管理一些公共属性,例如contextQueue,framebufferCache

  学习:将EAGLContext的setCurrentContext方法提取出来,用一个简单的类方法来封装,非常实惠的一个注意。由于此方法调用非常频繁,让我们在具体滤镜的实现过程中,忽略EAGLContext。(注意,在初始化GLProgram前,必须确定currentContext已配置正确)

A context encapsulates all OpenGL ES state for a single thread in your app. When you call any OpenGL ES API function, OpenGL ES evaluates it with respect to the calling thread’s current context. Because OpenGL ES functions require a current context, you must use this method to select a context for the current thread before calling any OpenGL ES function.