source: trunk/tutorial/08_fbo.lolfx @ 1735

Last change on this file since 1735 was 1735, checked in by sam, 11 years ago

tutorial: nicer blur and colour effect in the FBO tutorial.

File size: 1.3 KB
Line 
1-- GLSL.Vert --
2
3#version 120
4
5attribute vec2 in_Position;
6
7varying vec2 pass_Position;
8
9void main()
10{
11    pass_Position = in_Position;
12    gl_Position = vec4(in_Position, 0.0, 1.0);
13}
14
15-- GLSL.Frag --
16
17#version 120
18
19#if defined GL_ES
20precision highp float;
21#endif
22
23uniform sampler2D in_Texture;
24uniform float in_Flag;
25uniform vec3 in_Point;
26uniform vec3 in_Color;
27
28varying vec2 pass_Position;
29
30void main(void)
31{
32    if (in_Flag == 0.0)
33    {
34        float tc = 0.0, ta = 0.0;
35        {
36            float s = 4.0 + 3.0 * in_Point.z;
37            vec2 p = pass_Position - in_Point.xy * 0.8;
38            float t = clamp(1.2 - dot(s * p, s * p), 0.0, 1.0);
39            float u = t * t;
40            tc += 3.0 * t * t - 2.0 * t * t * t;
41            ta += 3.0 * u * u - 2.0 * u * u * u;
42        }
43
44        gl_FragColor = vec4(tc * in_Color, ta + 0.1);
45    }
46    else
47    {
48        vec2 texcoords = pass_Position * 0.5 + vec2(0.5, 0.5);
49        gl_FragColor = vec4(texture2D(in_Texture, texcoords).xyz, 1.0);
50    }
51}
52
53-- HLSL.Vert --
54
55void main(float2 in_Position : POSITION,
56          out float4 out_Position : POSITION)
57{
58    out_Position = float4(in_Position, 0.0, 1.0);
59}
60
61-- HLSL.Frag --
62
63void main(out float4 out_FragColor : COLOR)
64{
65    out_FragColor = float4(0.7, 0.2, 0.5, 1.0);
66}
67
Note: See TracBrowser for help on using the repository browser.