diff --git a/14/README.md b/14/README.md
index c27ca89..b52b9a5 100644
--- a/14/README.md
+++ b/14/README.md
@@ -14,18 +14,18 @@ Once the texture is loaded and linked to a valid ```uniform sampler2D``` you can
vec4 texture2D(sampler2D texture, vec2 coordinates)
```
-Check the following code to see how this works inside a shader:
+Check the following code where we load Hokusai's Wave (1830) as ```uniform sampler2D u_tex0``` and we call every pixel of it inside the billboard:
-
+
-Try:
+If you pay attention you will note that the coordinates for the texture are normalized! What a surprise right? Textures coordenates are consisten with the rest of the things we had saw and their coordenates are between 0.0 and 1.0 whitch match perfectly with the normalized space coordinates we have been using.
+
+Now that you have seen how we load correctly a texture is time to experiment to discover what we can do with it, by trying:
* Scaling the previus texture by half.
* Rotating the previus texture 90 degrees.
* Hooking the mouse position to the coordenates to move it.
-If you pay attention you will note that the coordinates for the texture are normalized! What a surprise right?
-
Why you should be excited about textures? Well first of all forget about the sad 255 values for channel, once your image is trasformed into a ```uniform sampler2D``` you have all the values between 0.0 and 1.0 (depending on what you set the ```precision``` to ). That's why shaders can make really beatiful post-processing effects.
Second, the [```vec2()```](index.html#vec2.md) means you can get values even between pixels. As we said before the textures are a continum. This means that if you set up your texture correctly you can ask for values all arround the surface of your image and the values will smoothly vary from pixel to pixel with no jumps!
@@ -34,6 +34,25 @@ Finnally, you can setup your image to repeat in the edges, so if you give values
All this features makes your images more like an infinit spandex fabric. You can streach and shrinks your texture without noticing the grid of bites they originally where compose of or the ends of it. To experience this take a look to the following code where we distort a texture using [the noise function we already made](../11/).
-
+
-In the next chapters we will learn how to do some image processing using shaders. You will note that finnaly the complexity of shader makes sense, because was in a big sense designed to do this type of process. We will start doing some image operations!
+## Texture resolution
+
+Aboves examples play really well with squared images. Because both sides are equal they perfectly match our squared billboard. But for non-squared images things can be a little more tricky. We need to know the original proportions of the image to know how to streatch it correctly. Thats way the texture's original width and height is pass into the shader as an ```uniform```. In our example framework will be a ```uniform vec2``` with the same name of the texture pluss the world ```Resolution``` at the end of it.
+
+![Eadweard's Muybridge study of motion](muybridge.jpg)
+
+Uncomment line 18 of the following example to scale correctly aboves image. Do you think you can centered?
+
+
+
+This could seam simple but the posibilities of modifing textures coordinates is enormus. For example: *sprite animations*.
+
+
+
+Now is your turn:
+
+* Can you make a kaleidoscope using what we have learn?
+*
+
+In the next chapters we will learn how to do some image processing using shaders. You will note that finnaly the complexity of shader makes sense, because was in a big sense designed to do this type of process. We will start doing some image operations!
\ No newline at end of file
diff --git a/14/kanagawa.jpg b/14/hokusai.jpg
similarity index 100%
rename from 14/kanagawa.jpg
rename to 14/hokusai.jpg
diff --git a/14/muybridge.jpg b/14/muybridge.jpg
new file mode 100644
index 0000000..6ddf68d
Binary files /dev/null and b/14/muybridge.jpg differ
diff --git a/14/texture-kaleidoscope.frag b/14/texture-kaleidoscope.frag
new file mode 100644
index 0000000..b7eab03
--- /dev/null
+++ b/14/texture-kaleidoscope.frag
@@ -0,0 +1,41 @@
+#ifdef GL_ES
+precision mediump float;
+#endif
+
+#define PI 3.14159265359
+#define TWO_PI 6.28318530718
+
+uniform sampler2D u_tex0;
+uniform vec2 u_tex0Resolution;
+
+uniform vec2 u_resolution;
+uniform vec2 u_mouse;
+uniform float u_time;
+
+// Based on Asalga shader
+// https://www.shadertoy.com/view/4ss3WX
+void main () {
+ vec2 st = gl_FragCoord.xy/u_resolution.xy;
+ float time = u_time*0.1;
+
+ // move to the center
+ st = st - 0.5;
+
+ // cartesian to polar coordinates
+ float r = length(st);
+ float a = atan(st.y, st.x);
+
+ // Repeat side acoriding to angle
+ float sides = 10.;
+ float ma = mod(a, TWO_PI/sides);
+ ma = abs(ma - PI/sides);
+
+ // polar to cartesian coordinates
+ st = r * vec2(cos(ma), sin(ma));
+ st = fract(st+time);
+
+ vec4 color = vec4(st.x,st.y,0.0,1.0);
+ color = texture2D(u_tex0,st);
+
+ gl_FragColor = color;
+}
\ No newline at end of file
diff --git a/14/texture-noise.frag b/14/texture-noise.frag
index e300512..518c076 100644
--- a/14/texture-noise.frag
+++ b/14/texture-noise.frag
@@ -48,8 +48,7 @@ void main () {
st *= scale;
st += radius * vec2(cos(angle),sin(angle));
- vec4 color = vec4(st.x,st.y,0.0,1.0);
- color = texture2D(u_tex0,st-offset);
+ vec4 color = texture2D(u_tex0,st);
gl_FragColor = color;
}
\ No newline at end of file
diff --git a/14/texture-resolution.frag b/14/texture-resolution.frag
new file mode 100644
index 0000000..8b9a6b9
--- /dev/null
+++ b/14/texture-resolution.frag
@@ -0,0 +1,23 @@
+#ifdef GL_ES
+precision mediump float;
+#endif
+
+uniform sampler2D u_tex0;
+uniform vec2 u_tex0Resolution;
+
+uniform vec2 u_resolution;
+uniform vec2 u_mouse;
+uniform float u_time;
+
+void main () {
+ vec2 st = gl_FragCoord.xy/u_resolution.xy;
+ vec4 color = vec4(0.0);
+
+ // Fix the proportions by finding the aspect ration
+ float aspect = u_tex0Resolution.x/u_tex0Resolution.y;
+ // st.y *= aspect; // and then applying to it
+
+ color = texture2D(u_tex0,st);
+
+ gl_FragColor = color;
+}
\ No newline at end of file
diff --git a/14/texture-sprite.frag b/14/texture-sprite.frag
new file mode 100644
index 0000000..24cd1c9
--- /dev/null
+++ b/14/texture-sprite.frag
@@ -0,0 +1,38 @@
+#ifdef GL_ES
+precision mediump float;
+#endif
+
+uniform sampler2D u_tex0;
+uniform vec2 u_tex0Resolution;
+
+int col = 5;
+int row = 4;
+
+uniform vec2 u_resolution;
+uniform vec2 u_mouse;
+uniform float u_time;
+
+void main () {
+ vec2 st = gl_FragCoord.xy/u_resolution.xy;
+ vec4 color = vec4(0.0);
+
+ // Resolution of one frame
+ vec2 fRes = u_tex0Resolution/vec2(float(col),float(row));
+
+ // Normalize value of the frame resolution
+ vec2 nRes = u_tex0Resolution/fRes;
+
+ // Scale the coordenates to a single frame
+ st = st/nRes;
+
+ // Calculate the offset in cols and rows
+ float timeX = u_time*15.;
+ float timeY = floor(timeX/float(col));
+ vec2 offset = vec2( floor(timeX)/nRes.x,
+ 1.0-(floor(timeY)/nRes.y) );
+ st = fract(st+offset);
+
+ color = texture2D(u_tex0,st);
+
+ gl_FragColor = color;
+}
\ No newline at end of file
diff --git a/16/README.md b/16/README.md
new file mode 100644
index 0000000..6ea7993
--- /dev/null
+++ b/16/README.md
@@ -0,0 +1 @@
+## Kernel convolutions
diff --git a/16/index.html b/16/index.html
new file mode 100644
index 0000000..53e44a7
--- /dev/null
+++ b/16/index.html
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+ Textures
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+