naelstrof пре 7 година
родитељ
комит
df3bd41ddd
1 измењених фајлова са 34 додато и 1 уклоњено
  1. 34
    1
      README.md

+ 34
- 1
README.md Прегледај датотеку

@@ -65,4 +65,37 @@ make && sudo make install
65 65
 ```
66 66
 
67 67
 ### Shaders
68
-These are implemented, but not flushed out. I haven't gotten around to writing some tutorials on them. So check back later!
68
+
69
+Slop allows for chained post-processing shaders. Shaders are written in a language called GLSL, and have access to the following data from slop:
70
+| GLSL Name  | Data Type      | Bound to                                                                                        |
71
+|------------|----------------|-------------------------------------------------------------------------------------------------|
72
+| mouse      | vec2           | The mouse position on the screen.                                                               |
73
+| desktop    | sampler2D      | An upside-down snapshot of the desktop, this doesn't update as the screen changes.              |
74
+| texture    | sampler2D      | The current pixel values of slop's frame buffer. Usually just contains the selection rectangle. |
75
+| screenSize | vec2           | The dimensions of the screen, where the x value is the width.                                   |
76
+| position   | vec2 attribute | This contains the vertex data for the rectangle. Only contains (0,0), (1,0), (1,1), and (0,1).  |
77
+| uv         | vec2 attribute | Same as the position, this contians the UV information of each vertext.                         |
78
+The desktop texture is upside-down because flipping it would cost valuable time.
79
+
80
+Shaders must be placed in your `${XDG_CONFIG_HOME}/slop` directory, where *XDG_CONFIG_HOME* is typically `~/.config/`. This folder won't exist unless you make it yourself.
81
+
82
+Shaders are loaded from the `--shader` flag in slop. They are delimited by commas, and rendered in order from left to right. This way you can combine multiple shaders for interesting effects! For example, `slop -rblur1,wiggle` would load `~/.config/slop/blur1{.frag,.vert}` and `~/.config/slop/wiggle{.frag,.vert}`. Then render the selection rectangle twice, each time accumulating the changes from the different shaders.
83
+
84
+Enough chatting about it though, here's some example shaders you can copy to `~/.config/slop` to try out!
85
+
86
+* `slop -rblur1,blur2 -b100` | `~/.config/slop/{blur1,blur2}{.frag,.vert}`
87
+![slop blur](https://my.mixtape.moe/bvsrzr.png)
88
+
89
+* `slop -rwiggle -b10` | `~/.config/slop/wiggle{.frag,.vert}`
90
+![slop animation](http://i.giphy.com/12vjSbFZ0CWDW8.gif)
91
+
92
+And all together now...
93
+
94
+* `slop -rblur1,blur2,wiggle -b50 -c1,1,1` | `~/.config/slop/{blur1,blur2,wiggle}{.frag,.vert}`
95
+![slop animation](http://i.giphy.com/kfBLafeJfLs2Y.gif)
96
+
97
+Finally here's an example of a magnifying glass.
98
+* `slop -rcrosshair` | `~/.config/slop/crosshair{.frag,.vert}`
99
+![slop animation](http://i.giphy.com/2xy0fC2LOFQfm.gif)
100
+
101
+It's fairly easy to adjust how the shaders work by editing them with your favourite text editor. Or even make your own!