From d3f101f42310d813ee1c28351f50a691edc2939f Mon Sep 17 00:00:00 2001 From: xissburg Date: Fri, 2 Nov 2012 11:34:08 -0200 Subject: [PATCH] Tiny README fixes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a0b5e0e..0ba11cc 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ While capturing you can grab a photo through the `takeAPhotoWithCompletion:`, wh To write your own shaders you should have a good grasp of the OpenGL architecture and especially the GLSL language and how shaders work. In short, a fragment shader is a piece of code that runs in the GPU for each pixel, and returns the final color for that pixel. You can have access to the value of some variables you define yourself in the shader. You can declare a `uniform` variable (constant for all pixels) and provide a value for it from your code that runs on the CPU and then use that value to compute the final color of the pixel. Using uniforms you can control things in your filter like blur radius, montion blur direction, etc. -Being a bit pedantic, the fragment shader is not actually run for each pixel. There might be more than a single _sampling point_ in each pixel on the screen, and the fragment shader is run for each of these sampling points. So, if we have 4 sampling points, the fragment shader will be run 4 times per pixel. But in what situation would a pixel have more than one sampling point? When we're using _multisampling anti-aliasing_. In order to keep the edges smooth, multisampling samples several points in different locations inside each pixel and averages the sampled values to obtain the final pixel color, in a step that is usually known as _resolving the multisample buffer_. +Being a bit pedantic, the fragment shader is not actually ran for each pixel. There might be more than a single _sampling point_ in each pixel on the screen, and the fragment shader is ran for each of these sampling points. So, if we have 4 sampling points, the fragment shader will be run 4 times per pixel. But in what situation would a pixel have more than one sampling point? When we're using _multisampling anti-aliasing_. In order to keep the edges smooth, multisampling samples several points in different locations inside each pixel and averages the sampled values to obtain the final pixel color, in a step that is usually known as _resolving the multisample framebuffer_. XBImageFilters use the class GLKProgram to store shader information. These programs are available in the `programs` NSArray property of the XBFilteredView (and its subclasses, of course). The `setValue:forUniformNamed:` method allows you to change the value of a uniform in your shader. You need to know its name (the variable name in the shader) and you have to provide the value in a buffer of the same size as the uniform type size (the data is copied and the memory is managed internally).