Skip to content

Commit

Permalink
Tiny README fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xissburg committed Nov 2, 2012
1 parent 43ca482 commit d3f101f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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).

Expand Down

0 comments on commit d3f101f

Please sign in to comment.