aboutsummaryrefslogtreecommitdiff
path: root/Gem/examples/02.advanced/18.gl_shading_language.pd
blob: 2ebc459e55e73c23fef6cadf23c09414381230c5 (plain)
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#N canvas 54 61 842 789 10;
#X declare -lib Gem;
#X obj 225 24 gemhead 1;
#X obj 225 47 world_light;
#X obj 77 112 gemhead;
#X obj 77 171 glsl_vertex;
#X obj 148 131 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X text 170 129 open a vertex-program;
#N canvas 0 22 450 300 open 0;
#X obj 75 103 openpanel;
#X obj 75 173 outlet;
#X obj 75 127 t b s;
#X msg 105 152 set open \$1;
#X obj 75 80 inlet;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 2 1 3 0;
#X connect 3 0 1 0;
#X connect 4 0 0 0;
#X restore 91 130 pd open;
#X msg 35 142 print;
#X obj 77 733 rotateXYZ;
#X obj 126 714 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10
-262144 -1 -1 0 256;
#X obj 126 697 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10
-262144 -1 -1 0 256;
#X obj 126 680 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10
-262144 -1 -1 0 256;
#X obj 206 25 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
;
#X obj 77 576 glsl_program;
#X obj 150 393 pack 0 0;
#X obj 143 246 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#N canvas 0 22 450 300 open 0;
#X obj 75 103 openpanel;
#X obj 75 173 outlet;
#X obj 75 127 t b s;
#X msg 105 152 set open \$1;
#X obj 75 80 inlet;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 2 1 3 0;
#X connect 3 0 1 0;
#X connect 4 0 0 0;
#X restore 86 245 pd open;
#X text 164 244 open a fragment-program;
#X msg 34 266 print;
#X obj 171 373 t b f;
#X msg 335 92 bang;
#X obj 77 753 teapot;
#X obj 171 328 change;
#X obj 149 190 change;
#X msg 150 433 link \$1 \$2;
#X msg 33 486 print;
#X msg 266 546 Phong \$1;
#X obj 269 508 hsl 128 15 -1 1 0 0 empty empty empty -2 -6 0 8 -262144
-1 -1 0 1;
#X floatatom 266 528 5 0 0 0 - - -;
#X obj 77 612 t a b;
#X obj 107 632 spigot;
#X obj 144 614 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X obj 107 652 i;
#X obj 135 652 + 1;
#X obj 163 652 % 360;
#X text 435 96 click here to load both the vertex- and the fragment-shader
;
#X text 165 172 the vertex shader;
#X obj 77 308 glsl_fragment;
#X text 191 311 the fragment shader;
#X text 222 395 whenever either the fragment-shader ID or the vertex-shader
ID has changed \, we trigger the linking of the 2 modules;
#X floatatom 171 354 2 0 0 0 ID - -;
#X floatatom 149 213 2 0 0 0 ID - -;
#X obj 168 454 print linking;
#X text 264 441 order of module IDs does not matter...;
#X text 96 487 after linking \, click "print" to get some info about
the compiled shader program;
#X text 330 550 the Toon-shader has a uniform variable "Phong" (see
"print") \, which we can change to modify the effect.;
#X text 213 264 pd's search path is searched for the given filename
\; just add the examples/data folder to your path options and this
example should work;
#X obj 335 133 t s s;
#X msg 91 150 open \$1.vert;
#X msg 86 265 open \$1.frag;
#X symbolatom 381 93 0 0 0 0 - - -;
#X obj 335 114 symbol ../data/Toon;
#N canvas 340 107 682 322 gemwin 0;
#X obj 102 122 tgl 15 0 \$0-gemstart \$0-gemstart empty 17 7 0 10 -262144
-1 -1 0 1;
#X obj 102 161 r \$0-gemstart;
#X obj 102 182 select 1 0;
#X msg 102 214 create \, 1;
#X msg 177 215 destroy;
#X obj 102 239 t a;
#X obj 318 54 inlet;
#X obj 318 255 gemwin;
#X obj 318 100 t a a;
#X obj 318 287 outlet;
#X obj 350 128 route create destroy;
#X obj 350 150 t b;
#X msg 350 172 1;
#X obj 390 150 t b;
#X msg 390 172 0;
#X obj 350 195 t f;
#X msg 350 219 set \$1;
#X text 118 122 rendering;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 2 1 4 0;
#X connect 3 0 5 0;
#X connect 4 0 5 0;
#X connect 5 0 8 0;
#X connect 6 0 8 0;
#X connect 7 0 9 0;
#X connect 8 0 7 0;
#X connect 8 1 10 0;
#X connect 10 0 11 0;
#X connect 10 1 13 0;
#X connect 11 0 12 0;
#X connect 12 0 15 0;
#X connect 13 0 14 0;
#X connect 14 0 15 0;
#X connect 15 0 16 0;
#X connect 16 0 0 0;
#X coords 0 -1 1 1 85 40 1 100 100;
#X restore 39 51 pd gemwin;
#X msg 39 29 lighting \$1;
#X obj 39 10 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
;
#X obj 738 8 declare -lib Gem;
#X connect 0 0 1 0;
#X connect 2 0 3 0;
#X connect 3 0 37 0;
#X connect 3 1 23 0;
#X connect 4 0 6 0;
#X connect 6 0 48 0;
#X connect 7 0 3 0;
#X connect 8 0 21 0;
#X connect 9 0 8 3;
#X connect 10 0 8 2;
#X connect 11 0 8 1;
#X connect 12 0 0 0;
#X connect 13 0 29 0;
#X connect 14 0 24 0;
#X connect 15 0 16 0;
#X connect 16 0 49 0;
#X connect 18 0 37 0;
#X connect 19 0 14 0;
#X connect 19 1 14 1;
#X connect 20 0 51 0;
#X connect 22 0 40 0;
#X connect 23 0 41 0;
#X connect 24 0 13 0;
#X connect 24 0 42 0;
#X connect 25 0 13 0;
#X connect 26 0 13 0;
#X connect 27 0 28 0;
#X connect 28 0 26 0;
#X connect 29 0 8 0;
#X connect 29 1 30 0;
#X connect 30 0 32 0;
#X connect 31 0 30 1;
#X connect 32 0 33 0;
#X connect 32 0 11 0;
#X connect 32 0 10 0;
#X connect 32 0 9 0;
#X connect 33 0 34 0;
#X connect 34 0 32 1;
#X connect 37 0 13 0;
#X connect 37 1 22 0;
#X connect 40 0 19 0;
#X connect 41 0 14 0;
#X connect 47 0 48 0;
#X connect 47 1 49 0;
#X connect 48 0 3 0;
#X connect 49 0 37 0;
#X connect 50 0 51 0;
#X connect 51 0 47 0;
#X connect 53 0 52 0;
#X connect 54 0 53 0;