1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
glslview
========
glslview is a simple program to run GLSL fragment shaders and interact with them.
glslview will render a simple fullscreen rectangle, the shader will determine each
pixel's color.
The glslwrite tool can be used to write the generated frames to PNG files
(with transparency support!).
You will need a graphics adapter and drivers with modern OpenGL/GLSL support.
Building
~~~~~~~~
glslview has been tested on Linux only, but it should work on other systems as well.
If it doesn't, I'm happy to take patches.
glslview has the following dependencies:
* SDL2
* libGL
* libGLEW
glslwrite additionally depends on libpng.
On Linux, glslview will use inotify to watch the loaded shader file for changes.
Running
~~~~~~~
Shader
------
glslview will supply the following uniform parameters to the shader:
vec2 res
The current resolution of the window
float time
Current time in milliseconds (by default since start of the program)
int param0, param1, param2
Modifiable parameters, 0 by default
The shader must define an output vec4 called "fragColor" into which the fragment color
is to be written.
See the examples provided with the source for more information. The "symmetry"
example makes use of all parameters.
Command line
------------
glslview <options> <shader>
glslwrite <options> <shader> <output directory>
Common options:
-w <width>
Initial window width (default: 800)
-h <height>
Initial window height (default: 800)
-0, -1, -2 <param>
Initial value for the shader parameters
glslview options:
-s <speed>
Initial speed factor (default: 1.0, negative values make time run backwards)
-t <time>
Initial time value (default: 0.0)
glslwrite options:
-s <step>
Time step between frames (default: 20.0)
-f <frame>
Number of frames to generate (default: run forever)
glslview control
----------------
+/-, scroll wheel
Change speed
=
Reset speed
<
Run backwards
>
Run forwards
r
Reset time
R
Reset parameters
l
Reload shader (if you're using a system without inotify, or inotify fails)
Space
Pause/continue
Page up/down
Modify param0
Left/right
Modify param1
Up/down
Modify param2
Escape
Quit
|