This file is indexed.

/usr/share/gtk-doc/html/clutter/ClutterShaderEffect.html is in libclutter-1.0-doc 1.20.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Clutter Reference Manual: ClutterShaderEffect</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="Clutter Reference Manual">
<link rel="up" href="ch06.html" title="Effects">
<link rel="prev" href="ClutterOffscreenEffect.html" title="ClutterOffscreenEffect">
<link rel="next" href="ClutterDeformEffect.html" title="ClutterDeformEffect">
<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#ClutterShaderEffect.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
                  <a href="#ClutterShaderEffect.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
                  <a href="#ClutterShaderEffect.properties" class="shortcut">Properties</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch06.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="ClutterOffscreenEffect.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="ClutterDeformEffect.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="ClutterShaderEffect"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="ClutterShaderEffect.top_of_page"></a>ClutterShaderEffect</span></h2>
<p>ClutterShaderEffect — Base class for shader effects</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="ClutterShaderEffect.functions"></a><h2>Functions</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="ClutterEffect.html" title="ClutterEffect"><span class="returnvalue">ClutterEffect</span></a> *
</td>
<td class="function_name">
<a class="link" href="ClutterShaderEffect.html#clutter-shader-effect-new" title="clutter_shader_effect_new ()">clutter_shader_effect_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="ClutterShaderEffect.html#clutter-shader-effect-set-uniform" title="clutter_shader_effect_set_uniform ()">clutter_shader_effect_set_uniform</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="ClutterShaderEffect.html#clutter-shader-effect-set-uniform-value" title="clutter_shader_effect_set_uniform_value ()">clutter_shader_effect_set_uniform_value</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="ClutterShaderEffect.html#clutter-shader-effect-set-shader-source" title="clutter_shader_effect_set_shader_source ()">clutter_shader_effect_set_shader_source</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">CoglHandle</span>
</td>
<td class="function_name">
<a class="link" href="ClutterShaderEffect.html#clutter-shader-effect-get-program" title="clutter_shader_effect_get_program ()">clutter_shader_effect_get_program</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">CoglHandle</span>
</td>
<td class="function_name">
<a class="link" href="ClutterShaderEffect.html#clutter-shader-effect-get-shader" title="clutter_shader_effect_get_shader ()">clutter_shader_effect_get_shader</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="ClutterShaderEffect.properties"></a><h2>Properties</h2>
<div class="informaltable"><table border="0">
<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>
<tbody><tr>
<td class="property_type"><a class="link" href="ClutterShaderEffect.html#ClutterShaderType" title="enum ClutterShaderType"><span class="type">ClutterShaderType</span></a></td>
<td class="property_name"><a class="link" href="ClutterShaderEffect.html#ClutterShaderEffect--shader-type" title="The “shader-type” property">shader-type</a></td>
<td class="property_flags">Write / Construct Only</td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="ClutterShaderEffect.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="ClutterShaderEffect.html#ClutterShaderType" title="enum ClutterShaderType">ClutterShaderType</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="ClutterShaderEffect.html#ClutterShaderEffect-struct" title="struct ClutterShaderEffect">ClutterShaderEffect</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="ClutterShaderEffect.html#ClutterShaderEffectClass" title="struct ClutterShaderEffectClass">ClutterShaderEffectClass</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="ClutterShaderEffect.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    GObject
    <span class="lineart">╰──</span> GInitiallyUnowned
        <span class="lineart">╰──</span> <a class="link" href="ClutterActorMeta.html" title="ClutterActorMeta">ClutterActorMeta</a>
            <span class="lineart">╰──</span> <a class="link" href="ClutterEffect.html" title="ClutterEffect">ClutterEffect</a>
                <span class="lineart">╰──</span> <a class="link" href="ClutterOffscreenEffect.html" title="ClutterOffscreenEffect">ClutterOffscreenEffect</a>
                    <span class="lineart">╰──</span> ClutterShaderEffect
</pre>
</div>
<div class="refsect1">
<a name="ClutterShaderEffect.description"></a><h2>Description</h2>
<p><a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> is a class that implements all the plumbing for
creating <a class="link" href="ClutterEffect.html" title="ClutterEffect"><span class="type">ClutterEffect</span></a>&lt;!-- --&gt;s using GLSL shaders.</p>
<p><a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> creates an offscreen buffer and then applies the
GLSL shader (after checking whether the compilation and linking were
successfull) to the buffer before painting it on screen.</p>
<p><a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> is available since Clutter 1.4</p>
<div class="refsect3">
<a name="id-1.5.7.3.7.5"></a><h4>Implementing a ClutterShaderEffect</h4>
<p>Creating a sub-class of <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> requires the
overriding of the <a class="link" href="ClutterOffscreenEffect.html#ClutterOffscreenEffectClass.paint-target"><code class="function">ClutterOffscreenEffectClass.paint_target()</code></a> virtual
function from the <a class="link" href="ClutterOffscreenEffect.html" title="ClutterOffscreenEffect"><span class="type">ClutterOffscreenEffect</span></a> class. It is also convenient
to implement the <a class="link" href="ClutterShaderEffect.html#ClutterShaderEffectClass.get-static-shader-source"><code class="function">ClutterShaderEffectClass.get_static_shader_source()</code></a>
virtual function in case you are planning to create more than one
instance of the effect.</p>
<p>The <a class="link" href="ClutterShaderEffect.html#ClutterShaderEffectClass.get-static-shader-source"><code class="function">ClutterShaderEffectClass.get_static_shader_source()</code></a>
function should return a copy of the shader source to use. This
function is only called once per subclass of <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a>
regardless of how many instances of the effect are created. The
source for the shader is typically stored in a static const
string which is returned from this function via
<code class="function">g_strdup()</code>.</p>
<p>The <a class="link" href="ClutterOffscreenEffect.html#ClutterOffscreenEffectClass.paint-target"><code class="function">ClutterOffscreenEffectClass.paint_target()</code></a> should set the
shader's uniforms if any. This is done by calling
<a class="link" href="ClutterShaderEffect.html#clutter-shader-effect-set-uniform-value" title="clutter_shader_effect_set_uniform_value ()"><code class="function">clutter_shader_effect_set_uniform_value()</code></a> or
<a class="link" href="ClutterShaderEffect.html#clutter-shader-effect-set-uniform" title="clutter_shader_effect_set_uniform ()"><code class="function">clutter_shader_effect_set_uniform()</code></a>. The sub-class should then
chain up to the <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> implementation.</p>
</div>
<div class="refsect3">
<a name="id-1.5.7.3.7.6"></a><h4>Setting uniforms on a ClutterShaderEffect</h4>
<p>The example below shows a typical implementation of the
<a class="link" href="ClutterShaderEffect.html#ClutterShaderEffectClass.get-static-shader-source"><code class="function">ClutterShaderEffectClass.get_static_shader_source()</code></a> and
<a class="link" href="ClutterOffscreenEffect.html#ClutterOffscreenEffectClass.paint-target"><code class="function">ClutterOffscreenEffectClass.paint_target()</code></a> virtual functions
for a <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> subclass.</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>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</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">static</span> gchar <span class="gtkdoc opt">*</span>
<span class="function">my_effect_get_static_shader_source</span> <span class="gtkdoc opt">(</span>ClutterShaderEffect <span class="gtkdoc opt">*</span>effect<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
  <span class="gtkdoc slc">// shader_source is set elsewhere</span>
  <span class="keyword">return</span> <span class="function">g_strdup</span> <span class="gtkdoc opt">(</span>shader_source<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span>

<span class="gtkdoc kwb">static</span> gboolean
<span class="function">my_effect_paint_target</span> <span class="gtkdoc opt">(</span>ClutterOffscreenEffect <span class="gtkdoc opt">*</span>effect<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
  MyEffect <span class="gtkdoc opt">*</span>self <span class="gtkdoc opt">=</span> <span class="function">MY_EFFECT</span> <span class="gtkdoc opt">(</span>effect<span class="gtkdoc opt">);</span>
  ClutterShaderEffect <span class="gtkdoc opt">*</span>shader <span class="gtkdoc opt">=</span> <span class="function">CLUTTER_SHADER_EFFECT</span> <span class="gtkdoc opt">(</span>effect<span class="gtkdoc opt">);</span>
  ClutterEffectClass <span class="gtkdoc opt">*</span>parent_class<span class="gtkdoc opt">;</span>
  gfloat component_r<span class="gtkdoc opt">,</span> component_g<span class="gtkdoc opt">,</span> component_b<span class="gtkdoc opt">;</span>

  <span class="gtkdoc slc">// the &quot;tex&quot; uniform is declared in the shader as:</span>
  <span class="gtkdoc slc">//</span>
  <span class="gtkdoc slc">//   uniform int tex;</span>
  <span class="gtkdoc slc">//</span>
  <span class="gtkdoc slc">// and it is passed a constant value of 0</span>
  <span class="function"><a href="ClutterShaderEffect.html#clutter-shader-effect-set-uniform">clutter_shader_effect_set_uniform</a></span> <span class="gtkdoc opt">(</span>shader<span class="gtkdoc opt">,</span> <span class="string">&quot;tex&quot;</span><span class="gtkdoc opt">,</span> G_TYPE_INT<span class="gtkdoc opt">,</span> <span class="number">1</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">);</span>

  <span class="gtkdoc slc">// the &quot;component&quot; uniform is declared in the shader as:</span>
  <span class="gtkdoc slc">//</span>
  <span class="gtkdoc slc">//   uniform vec3 component;</span>
  <span class="gtkdoc slc">//</span>
  <span class="gtkdoc slc">// and it's defined to contain the normalized components</span>
  <span class="gtkdoc slc">// of a #ClutterColor</span>
  component_r <span class="gtkdoc opt">=</span> self<span class="gtkdoc opt">-&gt;</span>color<span class="gtkdoc opt">.</span>red   <span class="gtkdoc opt">/</span> <span class="number">255.0</span>f<span class="gtkdoc opt">;</span>
  component_g <span class="gtkdoc opt">=</span> self<span class="gtkdoc opt">-&gt;</span>color<span class="gtkdoc opt">.</span>green <span class="gtkdoc opt">/</span> <span class="number">255.0</span>f<span class="gtkdoc opt">;</span>
  component_b <span class="gtkdoc opt">=</span> self<span class="gtkdoc opt">-&gt;</span>color<span class="gtkdoc opt">.</span>blue  <span class="gtkdoc opt">/</span> <span class="number">255.0</span>f<span class="gtkdoc opt">;</span>
  <span class="function"><a href="ClutterShaderEffect.html#clutter-shader-effect-set-uniform">clutter_shader_effect_set_uniform</a></span> <span class="gtkdoc opt">(</span>shader<span class="gtkdoc opt">,</span> <span class="string">&quot;component&quot;</span><span class="gtkdoc opt">,</span>
                                     G_TYPE_FLOAT<span class="gtkdoc opt">,</span> <span class="number">3</span><span class="gtkdoc opt">,</span>
                                     component_r<span class="gtkdoc opt">,</span>
                                     component_g<span class="gtkdoc opt">,</span>
                                     component_b<span class="gtkdoc opt">);</span>

  <span class="gtkdoc slc">// chain up to the parent's implementation</span>
  parent_class <span class="gtkdoc opt">=</span> <span class="function">CLUTTER_OFFSCREEN_EFFECT_CLASS</span> <span class="gtkdoc opt">(</span>my_effect_parent_class<span class="gtkdoc opt">);</span>
  <span class="keyword">return</span> parent_class<span class="gtkdoc opt">-&gt;</span><span class="function">paint_target</span> <span class="gtkdoc opt">(</span>effect<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
</div>
</div>
<div class="refsect1">
<a name="ClutterShaderEffect.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="clutter-shader-effect-new"></a><h3>clutter_shader_effect_new ()</h3>
<pre class="programlisting"><a class="link" href="ClutterEffect.html" title="ClutterEffect"><span class="returnvalue">ClutterEffect</span></a> *
clutter_shader_effect_new (<em class="parameter"><code><a class="link" href="ClutterShaderEffect.html#ClutterShaderType" title="enum ClutterShaderType"><span class="type">ClutterShaderType</span></a> shader_type</code></em>);</pre>
<p>Creates a new <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a>, to be applied to an actor using
<a class="link" href="ClutterActor.html#clutter-actor-add-effect" title="clutter_actor_add_effect ()"><code class="function">clutter_actor_add_effect()</code></a>.</p>
<p>The effect will be empty until <a class="link" href="ClutterShaderEffect.html#clutter-shader-effect-set-shader-source" title="clutter_shader_effect_set_shader_source ()"><code class="function">clutter_shader_effect_set_shader_source()</code></a>
is called.</p>
<div class="refsect3">
<a name="id-1.5.7.3.8.2.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>shader_type</p></td>
<td class="parameter_description"><p>the type of the shader, either <a class="link" href="ClutterShaderEffect.html#CLUTTER-FRAGMENT-SHADER:CAPS"><code class="literal">CLUTTER_FRAGMENT_SHADER</code></a>,
or <a class="link" href="ClutterShaderEffect.html#CLUTTER-VERTEX-SHADER:CAPS"><code class="literal">CLUTTER_VERTEX_SHADER</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.5.7.3.8.2.7"></a><h4>Returns</h4>
<p> the newly created <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a>.
Use <code class="function">g_object_unref()</code> when done.</p>
<p></p>
</div>
<p class="since">Since 1.8</p>
</div>
<hr>
<div class="refsect2">
<a name="clutter-shader-effect-set-uniform"></a><h3>clutter_shader_effect_set_uniform ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
clutter_shader_effect_set_uniform (<em class="parameter"><code><a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> *effect</code></em>,
                                   <em class="parameter"><code>const <span class="type">gchar</span> *name</code></em>,
                                   <em class="parameter"><code><span class="type">GType</span> gtype</code></em>,
                                   <em class="parameter"><code><span class="type">gsize</span> n_values</code></em>,
                                   <em class="parameter"><code>...</code></em>);</pre>
<p>Sets a list of values as the payload for the uniform <em class="parameter"><code>name</code></em>
 inside
the shader effect</p>
<p>The <em class="parameter"><code>gtype</code></em>
 must be one of: <code class="literal">G_TYPE_INT</code>, for 1 or more integer values;
<code class="literal">G_TYPE_FLOAT</code>, for 1 or more floating point values;
<code class="literal">CLUTTER_TYPE_SHADER_INT</code>, for a pointer to an array of integer values;
<code class="literal">CLUTTER_TYPE_SHADER_FLOAT</code>, for a pointer to an array of floating point
values; and <code class="literal">CLUTTER_TYPE_SHADER_MATRIX</code>, for a pointer to an array of
floating point values mapping a matrix</p>
<p>The number of values interepreted is defined by the <em class="parameter"><code>n_value</code></em>

argument, and by the <em class="parameter"><code>gtype</code></em>
 argument. For instance, a uniform named
"sampler0" and containing a single integer value is set using:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="function"><a href="ClutterShaderEffect.html#clutter-shader-effect-set-uniform">clutter_shader_effect_set_uniform</a></span> <span class="gtkdoc opt">(</span>effect<span class="gtkdoc opt">,</span> <span class="string">&quot;sampler0&quot;</span><span class="gtkdoc opt">,</span>
                                   G_TYPE_INT<span class="gtkdoc opt">,</span> <span class="number">1</span><span class="gtkdoc opt">,</span>
                                   <span class="number">0</span><span class="gtkdoc opt">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>While a uniform named "components" and containing a 3-elements vector
of floating point values (a "vec3") can be set using:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7</pre></td>
        <td class="listing_code"><pre class="programlisting">gfloat component_r<span class="gtkdoc opt">,</span> component_g<span class="gtkdoc opt">,</span> component_b<span class="gtkdoc opt">;</span>

<span class="function"><a href="ClutterShaderEffect.html#clutter-shader-effect-set-uniform">clutter_shader_effect_set_uniform</a></span> <span class="gtkdoc opt">(</span>effect<span class="gtkdoc opt">,</span> <span class="string">&quot;components&quot;</span><span class="gtkdoc opt">,</span>
                                   G_TYPE_FLOAT<span class="gtkdoc opt">,</span> <span class="number">3</span><span class="gtkdoc opt">,</span>
                                   component_r<span class="gtkdoc opt">,</span>
                                   component_g<span class="gtkdoc opt">,</span>
                                   component_b<span class="gtkdoc opt">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>or can be set using:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5</pre></td>
        <td class="listing_code"><pre class="programlisting">gfloat component_vec<span class="gtkdoc opt">[</span><span class="number">3</span><span class="gtkdoc opt">];</span>

<span class="function"><a href="ClutterShaderEffect.html#clutter-shader-effect-set-uniform">clutter_shader_effect_set_uniform</a></span> <span class="gtkdoc opt">(</span>effect<span class="gtkdoc opt">,</span> <span class="string">&quot;components&quot;</span><span class="gtkdoc opt">,</span>
                                   CLUTTER_TYPE_SHADER_FLOAT<span class="gtkdoc opt">,</span> <span class="number">3</span><span class="gtkdoc opt">,</span>
                                   component_vec<span class="gtkdoc opt">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>Finally, a uniform named "map" and containing a matrix can be set using:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="function"><a href="ClutterShaderEffect.html#clutter-shader-effect-set-uniform">clutter_shader_effect_set_uniform</a></span> <span class="gtkdoc opt">(</span>effect<span class="gtkdoc opt">,</span> <span class="string">&quot;map&quot;</span><span class="gtkdoc opt">,</span>
                                   CLUTTER_TYPE_SHADER_MATRIX<span class="gtkdoc opt">,</span> <span class="number">1</span><span class="gtkdoc opt">,</span>
                                   <span class="function">cogl_matrix_get_array</span> <span class="gtkdoc opt">(&amp;</span>matrix<span class="gtkdoc opt">));</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<div class="refsect3">
<a name="id-1.5.7.3.8.3.18"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>effect</p></td>
<td class="parameter_description"><p>a <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>the name of the uniform to set</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>gtype</p></td>
<td class="parameter_description"><p>the type of the uniform to set</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n_values</p></td>
<td class="parameter_description"><p>the number of values</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>a list of values</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 1.4</p>
</div>
<hr>
<div class="refsect2">
<a name="clutter-shader-effect-set-uniform-value"></a><h3>clutter_shader_effect_set_uniform_value ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
clutter_shader_effect_set_uniform_value
                               (<em class="parameter"><code><a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> *effect</code></em>,
                                <em class="parameter"><code>const <span class="type">gchar</span> *name</code></em>,
                                <em class="parameter"><code>const <span class="type">GValue</span> *value</code></em>);</pre>
<p>Sets <em class="parameter"><code>value</code></em>
 as the payload for the uniform <em class="parameter"><code>name</code></em>
 inside the shader
effect</p>
<p>The <span class="type">GType</span> of the <em class="parameter"><code>value</code></em>
 must be one of: <code class="literal">G_TYPE_INT</code>, for a single
integer value; <code class="literal">G_TYPE_FLOAT</code>, for a single floating point value;
<code class="literal">CLUTTER_TYPE_SHADER_INT</code>, for an array of integer values;
<code class="literal">CLUTTER_TYPE_SHADER_FLOAT</code>, for an array of floating point values;
and <code class="literal">CLUTTER_TYPE_SHADER_MATRIX</code>, for a matrix of floating point
values. It also accepts <code class="literal">G_TYPE_DOUBLE</code> for compatibility with other
languages than C.</p>
<div class="refsect3">
<a name="id-1.5.7.3.8.4.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>effect</p></td>
<td class="parameter_description"><p>a <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>the name of the uniform to set</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <span class="type">GValue</span> with the value of the uniform to set</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 1.4</p>
</div>
<hr>
<div class="refsect2">
<a name="clutter-shader-effect-set-shader-source"></a><h3>clutter_shader_effect_set_shader_source ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
clutter_shader_effect_set_shader_source
                               (<em class="parameter"><code><a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> *effect</code></em>,
                                <em class="parameter"><code>const <span class="type">gchar</span> *source</code></em>);</pre>
<p>Sets the source of the GLSL shader used by <em class="parameter"><code>effect</code></em>
</p>
<p>This function should only be called by implementations of
the <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> class, and not by application code.</p>
<p>This function can only be called once; subsequent calls will
yield no result.</p>
<div class="refsect3">
<a name="id-1.5.7.3.8.5.7"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>effect</p></td>
<td class="parameter_description"><p>a <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>source</p></td>
<td class="parameter_description"><p>the source of a GLSL shader</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.5.7.3.8.5.8"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the source was set</p>
<p></p>
</div>
<p class="since">Since 1.4</p>
</div>
<hr>
<div class="refsect2">
<a name="clutter-shader-effect-get-program"></a><h3>clutter_shader_effect_get_program ()</h3>
<pre class="programlisting"><span class="returnvalue">CoglHandle</span>
clutter_shader_effect_get_program (<em class="parameter"><code><a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> *effect</code></em>);</pre>
<p>Retrieves a pointer to the program's handle</p>
<div class="refsect3">
<a name="id-1.5.7.3.8.6.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>effect</p></td>
<td class="parameter_description"><p>a <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.5.7.3.8.6.6"></a><h4>Returns</h4>
<p> a pointer to the program's handle,
or <code class="literal">COGL_INVALID_HANDLE</code>. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since 1.4</p>
</div>
<hr>
<div class="refsect2">
<a name="clutter-shader-effect-get-shader"></a><h3>clutter_shader_effect_get_shader ()</h3>
<pre class="programlisting"><span class="returnvalue">CoglHandle</span>
clutter_shader_effect_get_shader (<em class="parameter"><code><a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> *effect</code></em>);</pre>
<p>Retrieves a pointer to the shader's handle</p>
<div class="refsect3">
<a name="id-1.5.7.3.8.7.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>effect</p></td>
<td class="parameter_description"><p>a <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.5.7.3.8.7.6"></a><h4>Returns</h4>
<p> a pointer to the shader's handle,
or <code class="literal">COGL_INVALID_HANDLE</code>. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since 1.4</p>
</div>
</div>
<div class="refsect1">
<a name="ClutterShaderEffect.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="ClutterShaderType"></a><h3>enum ClutterShaderType</h3>
<p>The type of GLSL shader program</p>
<div class="refsect3">
<a name="id-1.5.7.3.9.2.4"></a><h4>Members</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="CLUTTER-VERTEX-SHADER:CAPS"></a>CLUTTER_VERTEX_SHADER</p></td>
<td class="enum_member_description">
<p>a vertex shader</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="CLUTTER-FRAGMENT-SHADER:CAPS"></a>CLUTTER_FRAGMENT_SHADER</p></td>
<td class="enum_member_description">
<p>a fragment shader</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 1.4</p>
</div>
<hr>
<div class="refsect2">
<a name="ClutterShaderEffect-struct"></a><h3>struct ClutterShaderEffect</h3>
<pre class="programlisting">struct ClutterShaderEffect;</pre>
<p>The <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> structure contains
only private data and should be accessed using the provided API</p>
<p class="since">Since 1.4</p>
</div>
<hr>
<div class="refsect2">
<a name="ClutterShaderEffectClass"></a><h3>struct ClutterShaderEffectClass</h3>
<pre class="programlisting">struct ClutterShaderEffectClass {
  gchar * (* get_static_shader_source) (ClutterShaderEffect *effect);
};
</pre>
<p>The <a class="link" href="ClutterShaderEffect.html#ClutterShaderEffectClass" title="struct ClutterShaderEffectClass"><span class="type">ClutterShaderEffectClass</span></a> structure contains
only private data</p>
<div class="refsect3">
<a name="id-1.5.7.3.9.4.5"></a><h4>Members</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody><tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="ClutterShaderEffectClass.get-static-shader-source"></a>get_static_shader_source</code></em> ()</p></td>
<td class="struct_member_description"><p>Returns the GLSL source code to use for
instances of this shader effect. Note that this function is only
called once per subclass of <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a> regardless of how
many instances are used. It is expected that subclasses will return
a copy of a static string from this function.</p></td>
<td class="struct_member_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since 1.4</p>
</div>
</div>
<div class="refsect1">
<a name="ClutterShaderEffect.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="ClutterShaderEffect--shader-type"></a><h3>The <code class="literal">“shader-type”</code> property</h3>
<pre class="programlisting">  “shader-type”              <a class="link" href="ClutterShaderEffect.html#ClutterShaderType" title="enum ClutterShaderType"><span class="type">ClutterShaderType</span></a></pre>
<p>The type of shader that is used by the effect. This property
should be set by the constructor of <a class="link" href="ClutterShaderEffect.html" title="ClutterShaderEffect"><span class="type">ClutterShaderEffect</span></a>
sub-classes.</p>
<p>Flags: Write / Construct Only</p>
<p>Default value: CLUTTER_FRAGMENT_SHADER</p>
<p class="since">Since 1.4</p>
</div>
</div>
<div class="refsect1">
<a name="ClutterShaderEffect.see-also"></a><h2>See Also</h2>
<p><a class="link" href="ClutterEffect.html" title="ClutterEffect"><span class="type">ClutterEffect</span></a>, <a class="link" href="ClutterOffscreenEffect.html" title="ClutterOffscreenEffect"><span class="type">ClutterOffscreenEffect</span></a></p>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.21</div>
</body>
</html>